This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Add this to your .git/hooks/ folder to run Swiftlint and Swiftformat | |
# | |
set -eo pipefail | |
# Redirect output to stderr | |
exec 1>&2 | |
if [ `arch` == "arm64" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = VNDetectBarcodesRequest(completionHandler: nil) | |
request.symbologies = VNDetectBarcodesRequest | |
.supportedSymbologies | |
.filter { | |
$0.rawValue.contains("PDF417") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = VNDetectBarcodesRequest(completionHandler: nil) | |
if #available(iOS 15, *) { | |
request.symbologies = [.pdf417] | |
} else { | |
request.symbologies = [.PDF417] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let request = VNDetectBarcodesRequest(completionHandler: nil) | |
request.symbologies = [.PDF417] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
/// Returns a system image on iOS 13, otherwise returns an image from the Bundle provided. | |
convenience init?(nameOrSystemName: String, in bundle: Bundle? = Bundle.main, compatibleWith traitCollection: UITraitCollection? = nil) { | |
if #available(iOS 13, *) { | |
self.init(systemName: nameOrSystemName, compatibleWith: traitCollection) | |
} else { | |
self.init(named: nameOrSystemName, in: bundle, compatibleWith: traitCollection) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
class ArcProgressViewController : UIViewController { | |
private lazy var backgroundLayer: CAShapeLayer = { | |
let layer = CAShapeLayer() | |
layer.frame = CGRect(x: 25, y: 25, width: 325, height: 325) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gives lets us use generics when compiling with Xcode 7 but will still compile using Xcode 6 | |
#if __has_feature(objc_generics) | |
#define _generify(CODE) <CODE> | |
#define _generify_dict(KEY_TYPE, VAL_TYPE) <KEY_TYPE, VAL_TYPE> | |
#else | |
#define _generify(CODE) | |
#define _generify_dict(KEY_TYPE, VAL_TYPE) | |
#endif | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Listen for video playback | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(videoPlayingDidChange:) | |
name:@"SomeClientPlayingDidChange" | |
object:nil]; | |
// Video playing state handler | |
- (void)videoPlayingDidChange:(NSNotification *)notification | |
{ | |
BOOL isPlaying = [notification.userInfo[@"IsPlaying"] boolValue]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[NSNotificationCenter defaultCenter] addObserverForName:nil | |
object:nil | |
queue:nil | |
usingBlock:^(NSNotification* notification) { | |
NSLog(@"Notification:\n"\ | |
"name: %@\n"\ | |
"object: %@\n"\ | |
"userInfo: %@", | |
notification.name, | |
notification.object, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can test ATS diagnositcs in Mac OS X El Capitan by running: | |
nscurl --ats-diagnostics -v https://s3.amazonaws.com | |
Here is the log: | |
================================================================================ | |
Starting ATS Diagnostics | |
Configuring ATS Info.plist keys and displaying the result of HTTPS loads to https://s3.amazonaws.com. |
NewerOlder