Update. This approach is no longer valid, an Assistant is basically a Model, as what I wrongly described here was an MVC without the M part. I’ve been lately using the the Coordinator pattern (actually its variation Coordinator+ViewModel), and while the pattern is a very good one in terms of separation of concerns, it does […]
Tag: Swift
Swift – make your life easier with promises
A while ago I wrote a series of articles about Promises in Objective-C, and described the way promises help us write async code in an async manner, help us pipeline data streams and recover from errors by giving the pipeline another thing to process. Well, time has passed, Swift came along, and promises look better […]
Retrying async functions in Swift via high-order functions
TL;DR; Solution can be also found here. Supposing we’re writing a client-server communication layer, and we want to add support for retrying failed calls for a number of times before giving up and reporting error. A classical example would be updating a user’s profile when pressing a Save button from the UI. A typical function might look like […]
if-let statement in Objective-C
I just found an equivalent to Swift’s if-let construct, and thought to share it 🙂 Swift: [swift gutter=”false”] if let result = computeResult() { // do something with result } [/swift] Objective-C: [objc gutter=”false”] for(SomeClass *result = [self computeResult]; result != nil; result = nil) { // do something with result } [/objc] You no […]
Recent Comments