This file contains hidden or 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
struct Regex { | |
let pattern: String | |
let options: NSRegularExpressionOptions! | |
private var matcher: NSRegularExpression { | |
return NSRegularExpression(pattern: self.pattern, options: self.options, error: nil) | |
} | |
init(pattern: String, options: NSRegularExpressionOptions = nil) { | |
self.pattern = pattern |
This file contains hidden or 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
import Foundation | |
// | |
// MARK: - JSONError Type | |
// | |
public enum JSONError: ErrorType, CustomStringConvertible { | |
case KeyNotFound(key: JSONKeyType) | |
case NullValue(key: JSONKeyType) | |
case TypeMismatch(expected: Any, actual: Any) |
This file contains hidden or 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
//: angleGradientImage - Ported to Swift from http://stackoverflow.com/a/33991838/136582 | |
import UIKit | |
import CoreImage | |
public func angleGradientImage(size: CGSize, radius: Float?, scale: CGFloat?, colors: (start:UIColor, end:UIColor)?) -> UIImage? { | |
let gradientRadius = (radius != nil) ? radius! : Float(min(size.width,size.height) - 2) | |
let gradientScale = (scale != nil) ? scale! : UIScreen.mainScreen().scale | |
let startColor : CIColor | |
let endColor : CIColor |
This file contains hidden or 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
/** | |
* Taken from @jspahrsummers: | |
* | |
* To avoid preprocessor definition collisions when working with third-party frameworks | |
* try this... | |
*/ | |
#define strongify myPrefix_strongify | |
#define weakify myPrefix_weakify | |
#define onExit myPrefix_onExit |
OlderNewer