I hereby claim:
- I am natecook1000 on github.
- I am nnnnnnnn (https://keybase.io/nnnnnnnn) on keybase.
- I have a public key whose fingerprint is CAC7 670D 18D7 D73C AFDF 36C5 B26F D823 319D 4365
To claim this, I am signing this object:
| class SimplePickerView : UIPickerView { | |
| class SimplePickerViewModel : NSObject, UIPickerViewDelegate, UIPickerViewDataSource { | |
| var titles: [String] | |
| var selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())? | |
| init(titles: [String], selectionHandler: ((pickerView: UIPickerView, row: Int, title: String) -> ())? = nil) { | |
| self.titles = titles | |
| self.selectionHandler = selectionHandler | |
| } |
| // CalculatorView.swift | |
| // as seen in http://nshipster.com/ibinspectable-ibdesignable/ | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| /// The alignment for drawing an String inside a bounding rectangle. | |
| enum NCStringAlignment { | |
| case LeftTop | |
| case CenterTop | |
| case RightTop |
| // OptionalBinding.swift | |
| // as seen in http://nshipster.com/swift-1.2/ | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| let a: Int? = 10 | |
| let b: Int? = 5 | |
| let c: Int? = 3 | |
| let d: Int? = -2 | |
| let e: Int? = 0 |
| // NSScanner+Swift.swift | |
| // A set of Swift-idiomatic methods for NSScanner | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| import Foundation | |
| extension NSScanner { | |
| // MARK: Strings |
| // integerWithBytes.swift | |
| // as seen in http://natecook.com/blog/2015/03/a-sanatorium-for-swift-generics/ | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| protocol BitshiftOperationsType { | |
| func <<(lhs: Self, rhs: Self) -> Self | |
| func >>(lhs: Self, rhs: Self) -> Self | |
| func <<=(inout lhs: Self, rhs: Self) | |
| func >>=(inout lhs: Self, rhs: Self) |
| // NSCalendar+Swift.swift | |
| // A set of Swift-idiomatic methods for NSCalendar | |
| // | |
| // (c) 2015 Nate Cook, licensed under the MIT license | |
| extension NSCalendar { | |
| /// Returns the hour, minute, second, and nanoseconds of a given date. | |
| func getTimeFromDate(date: NSDate) -> (hour: Int, minute: Int, second: Int, nanosecond: Int) { | |
| var (hour, minute, second, nanosecond) = (0, 0, 0, 0) | |
| getHour(&hour, minute: &minute, second: &second, nanosecond: &nanosecond, fromDate: date) |
| enum Test { | |
| case One | |
| case Two | |
| var testDot: String { | |
| switch self { | |
| case .One: | |
| return "One" | |
| case .Two: | |
| return "Two" |
| enum Result { | |
| case Success(String) | |
| case Failure(String) | |
| var successString: String? { | |
| switch self { | |
| case let .Success(str): | |
| return str | |
| default: | |
| return nil |
I hereby claim:
To claim this, I am signing this object:
| protocol OptionalType { | |
| typealias T | |
| func flatMap<U>(@noescape f: (T) -> U?) -> U? | |
| } | |
| extension Optional : OptionalType { } | |
| extension SequenceType where Generator.Element: OptionalType { | |
| func flatten() -> [Generator.Element.T] { | |
| return self.map { $0.flatMap { $0 } } |