Schedulers

When you think about ReactiveCocoa, one immediately thinks about Signals, streams of events and transformations. Although that's all there, RAC is more than meets the eye. Lately I had to do the following: Track if a user spends more than 2 seconds in a screen. I went with viewDidAppear: and…

#2 Diary of a Secret App: AutoLayout

I had a rough battle with AutoLayout these days[1]. The following notes are in the context of a UITableView with dynamic sizing cells. : If you want to change an UITableViewCell's layoutMargins, don't use Interface Builder. After some time tracking this down, it seems that if you set contentView's "…

Generic UIViewControllers

Update 1/09/2015: Code tested on Xcode 7.0 beta 5 (7A176x) Note: Kudos to Robert for lending me his brain in some of this decisions. Context Imagine you want to display some photos and videos in a UITableView. Both the photos and the videos have their own feed,…

Bye Storyboards

Storyboards are awesome and if I was doing Objective-c, I would probably still be using them. But the thing with Swift and Storyboards, is that it shows that there is still some friction between the language and Cocoa. Image you have this: class MyAwesomeVC: UIViewController { let bar : Bar } As you…

Monads

Note: This is an exploratory post, where I will write about some ideas that are still fresh in my mind and need consolidation. Any mistake, lack of objectivity/rigor, that you find, please let me know. I also tried to balance between being practical and respecting the nomenclature. I started…

McFlurryâ„¢

While working with RAC 3.0, I find myself in this situation a lot[1]: aSignal.flatMapLatest { v in transformation(v) } Which can be simplified into: aSignal.flatMapLatest(transformation) The problem is when our transformation, doesn't really fit what we need. func fileCreationDate(fullPath: String) -> SignalProducer<NSDate,…

Map and Flatmap

This week, I explained to my colleagues what's the difference between a map and a flatMap[1]. The trick was: focus on the types and leave the burritos for lunch time. Monads and cheese pic.twitter.com/nT3DJ51qXt — R. Peres (@RuiAAPeres) July 24, 2015 Map [a] -> (a…

On Swift adoption

I mostly agree with Benjamin on Objective-C in a Swift World . In particular: Learning bleeding edge technology is like investing in a startup: you take on insane risk for potentially massive rewards.…

Two keys, one hole with Argo

Imagine you have this struct: struct Image { let url : NSURL let description : String? let size : CGSize } And the JSON coming from the server: { url: "http://myimage.jpg", height: 115, description: "What an awesome image", width: 154 } In this particular case we want to build our CGSize…