A simple idea using the trick of keypath(...)
derived from libextobjc and ReactiveCocoa and null-object pattern.
Create a category method in NSObject and define a macro PropertyNameForClass()
.
NSObject+PropertyName.h:
#import
platform :ios, '7.0' | |
# Core Data | |
pod 'SSDataKit', :git => 'https://github.com/soffes/SSDataKit', :commit => '60d432e734ae11e8cfedac8ac5f68c0ce8a1b9ba' | |
# On-disk & in-memory caching | |
pod 'SAMCache' | |
# Fast image view for Core Image | |
pod 'SAMCoreImageView', '0.1.3' |
extension Int { | |
func times(task:() -> ()) { | |
for i in 0..self { | |
task() | |
} | |
} | |
} | |
5.times { | |
println("Hey! You look really like Ruby") |
changeAlert = [UIAlertController alertControllerWithTitle:@"title" message:@"message" preferredStyle:UIAlertControllerStyleAlert]; | |
UIAlertController* __weak weakAlert = changeAlert; | |
UIAlertAction *alertActionOk = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { | |
UITextField *t = [[weakAlert textFields] firstObject]; | |
DLog(@"%@",t.text); | |
[weakAlert dismissViewControllerAnimated:YES completion:nil]; | |
}]; | |
UIAlertAction *alertActionCancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { | |
DLog(@"%@",action); |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
@import Foundation; | |
@interface KKWatchAppNotificationCenter : NSObject | |
+ (instancetype)sharedCenter; | |
- (void)postNotification:(NSString *)key; | |
- (void)addTarget:(id)target selector:(SEL)selector name:(NSString *)notification; | |
- (void)removeObserver:(NSObject *)observer; | |
@end |
A simple idea using the trick of keypath(...)
derived from libextobjc and ReactiveCocoa and null-object pattern.
Create a category method in NSObject and define a macro PropertyNameForClass()
.
NSObject+PropertyName.h:
#import
extension WKInterfaceController { | |
func animateWithDuration(duration: NSTimeInterval, animations: () -> Void, completion: (() -> Void)?) { | |
animateWithDuration(duration, animations: animations) | |
let delay = dispatch_time(DISPATCH_TIME_NOW, Int64(duration * Double(NSEC_PER_SEC))) | |
dispatch_after(delay, dispatch_get_main_queue()) { | |
completion?() | |
} | |
} | |
PS: If you liked this talk or like this concept, let's chat about iOS development at Stitch Fix! #shamelessplug
Speaker: David Abrahams. (Tech lead for Swift standard library)
"Crusty" is an old-school programmer who doesn't trust IDE's, debuggers, programming fads. He's cynical, grumpy.
OOP has been around since the 1970's. It's not actually new.
Classes are Awesome
var fetchedResultsProcessingOperations: [NSBlockOperation] = [] | |
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) { | |
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock)) | |
} | |
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { | |
switch type { | |
case .Insert: |
The response to my first few posts has been much larger than I’d imagined and I’d like to thank everyone for the encouragement.
If you’re interested in building a trading system I recommend first reading my previous post on general ideas to keep in mind.
My first really technical post will be on how to build a limit order book, probably the single most important component of a trading system. Because the data structure chosen to represent the limit order book will be the primary source of market information for trading models, it is important to make it both absolutely correct and extremely fast.
To give some idea of the data volumes, the Nasdaq TotalView ITCH feed, which is every event in every instrument traded on the Nasdaq, can have data rates of 20+ gigabytes/day with spikes of 3 megabytes/second or more. The individual messages average about 20 bytes each so this means handling