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
| ALAssetRepresentation *rep = [asset defaultRepresentation]; | |
| NSDictionary *dict = [rep metadata]; | |
| NSString *xmp = dict[@"AdjustmentXMP"]; | |
| NSData *xmpData = [xmp dataUsingEncoding:NSUTF8StringEncoding]; | |
| NSError *e = nil; | |
| NSArray *filters = [CIFilter filterArrayFromSerializedXMP:xmpData inputImageExtent:CGRectZero error:&e]; | |
| CIFilter *filter = [filters firstObject]; | |
| CIImage *image =[CIImage imageWithCGImage: [rep fullScreenImage]]; | |
| [filter setValue:image forKey:kCIInputImageKey]; |
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
| class Person { | |
| class func classString() -> String { | |
| return NSStringFromClass(self) | |
| } | |
| } | |
| Person.classString() // "_TtC11lldb_expr_06Person" |
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
| override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) | |
| { | |
| if let vc = segue.destinationViewController as? CreateNoteViewController { | |
| println("Create Note VC") | |
| } | |
| if let vc = segue.destinationViewController as? SingleNoteViewController { | |
| println("Show single note") | |
| } | |
| } |
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 Cocoa | |
| infix operator ||= {} | |
| func ||= <T> (inout value: T?, newValue: @autoclosure () -> T) -> T { | |
| if value == nil { | |
| value = newValue() | |
| } | |
| return value! |
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
| extension NSString { | |
| func toDateWithFormatter(dateFormatter: NSDateFormatter) -> NSDate? { | |
| return dateFormatter.dateFromString(self) | |
| } | |
| } |
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
| extension Array { | |
| func twoAtATime(block: ((f: T, s: T))->()) { | |
| var _first: T? = nil | |
| var _second: T? = nil | |
| for e:T in self { | |
| _first = _second | |
| _second = e | |
| if _first != nil && _second != nil { |
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 Cocoa | |
| @IBDesignable | |
| class <#ClassName#> : NSView { | |
| override init(frame frameRect: NSRect) { | |
| super.init(frame: frameRect) | |
| commonSetup() | |
| } | |
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 Dispatch { | |
| static func onMainQueue(block:()->()) { | |
| onMainQueueWithDelay(0, block: block) | |
| } | |
| static func onMainQueueWithDelay(delay: NSTimeInterval, block:()->()) { | |
| var queue: dispatch_queue_t = dispatch_get_main_queue() | |
| onQueue(queue, withDelay: delay, block: block) | |
| } |
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
| extension Array { | |
| func elementsInRange(start: Int, length: Int) -> Slice<T>? { | |
| if start >= self.count { | |
| return nil | |
| } | |
| var lastIndex = start + length | |
| if start + length > self.count { |
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 CoreData | |
| extension NSFetchedResultsController { | |
| var indexPaths: [NSIndexPath] { | |
| var paths = [NSIndexPath]() | |
| var sectionNumber = 0 | |
| for singleSection in sections as [NSFetchedResultsSectionInfo] { |
OlderNewer