of the Oyster iOS app • Discuss techniques for scaling iOS codebases: • better asynchronous programming • displaying/navigating large amounts of data • building hybrid (web-native) interfaces
Programming. It provides APIs for composing and transforming streams of values.” • Easy to wrap block-based interfaces with RACSignal • Sort of like NSOperation • Simplifies asynchronous programming
getBooksForList:list] subscribeError:^(NSError *error) { // Called if request fails } completed:^{ // Called if request succeeds }]; } ! - (void)getBooksForAllLists:(NSArray *)allLists { [[[self client] getBooksForLists:allLists] subscribeError:^(NSError *error) { // Called if any list request fails } completed:^{ // Called if all list requests succeed }]; } better asynchronous programming ✔
UI • Many instances of nested collection views • Separate data sources by section (“section controllers”) • Handle data retrieval and cell creation for one section • Optionally, override layout attributes (section inset, cell size)
Challenges • Fast loading • Easy/seamless navigation • Saving, syncing and restoring reading locations • Accounting for different book formats/inconsistent markup • Content protection (DRM)
• HTML from EPUBs loaded via NSURLProtocol directly into UIWebView • Full details on the @OysterEng blog http://engineering.oysterbooks.com • Besides links in HTML, all views/controls are native (including highlights!)
the behavior of the URL loading system • Load data from pretty much anywhere using Objective-C • In our case, decrypt and load directly from a zip (EPUB) archive
Use ReactiveCocoa for better asynchronous programming ✔ • Use multiple UICollectionView data sources for displaying/navigating large amounts of data ✔ • Use NSURLProtocol to build powerful hybrid (web-native) interfaces ✔