I hereby claim:
- I am danielctull on github.
- I am danielctull (https://keybase.io/danielctull) on keybase.
- I have a public key ASCl7emory6aN12AhnRtqg-o8bSLZcWLJFdPl1KLO0Vcigo
To claim this, I am signing this object:
| import Foundation | |
| extension String { | |
| func pad(to length: Int) -> String { | |
| guard self.characters.count < length else { | |
| return self | |
| } |
| import Cocoa | |
| class ReplaceSegue: NSStoryboardSegue { | |
| override func perform() { | |
| guard | |
| let source = sourceController as? NSViewController, | |
| let new = destinationController as? NSViewController, |
| // Used to make sure the value is 0 or above | |
| public struct Positive { | |
| let value: Float | |
| public init(_ value: Float) { | |
| if value < 0 { | |
| self.value = 0 |
| @implementation AppDelegate | |
| #pragma mark - Key Command Controller | |
| - (KeyCommandController *)keyCommandController { | |
| if (!_keyCommandController) { | |
| UIViewController *rootViewController = self.window.rootViewController; | |
| if (rootViewController){ |
| import Foundation | |
| protocol File {} | |
| class FileClass: File {} | |
| let set = NSOrderedSet(array: [FileClass(), FileClass()]) | |
| let files = set.array as? [File] // Type 'File' does not conform to protocol 'AnyObject' |
I hereby claim:
To claim this, I am signing this object:
| import CoreText | |
| extension CTFrame { | |
| var lines: [CTLine] { | |
| // This is the only way I've currently found to get the | |
| // CFArray of CTLines to cast to a swift array. | |
| let linesAO: [AnyObject] = CTFrameGetLines(self) as [AnyObject] |
| var images: [UIImage] = [] | |
| for i in 0...9 { | |
| guard let image = UIImage(named: "Loading \(i)") else { | |
| continue | |
| } | |
| images.append(image) | |
| } |
| let integerToDescribe = 5 | |
| var description = "The number \(integerToDescribe) is" | |
| switch integerToDescribe { | |
| case 2, 3, 5, 7, 11, 13, 17, 19: | |
| description += " a prime number, and also" | |
| } | |
| description += " an integer." |
| var phone: String? { | |
| guard | |
| let phone = phoneNumberTextField?.text, | |
| let phoneDetector = try? NSDataDetector(types: NSTextCheckingType.PhoneNumber.rawValue), | |
| let range = pure(NSRange(location: 0, length: phone.startIndex.distanceTo(phone.endIndex))), | |
| let matches = pure(phoneDetector.matchesInString(phone, options: [], range: range)) | |
| where matches.count > 0 | |
| else { | |
| return nil |