Natasha The Robot

Currently learning... Swift!

You can follow me on Twitter here.

Subscribe via RSS here.

Subscribe to my Swift newsletter

A Beautiful Solution to Non-Optional UIImage Named in Swift

Yesterday, I got around to watching the Swift in Practice WWDC15 Session, and I LOVED the suggestion for dealing with Image naming in Swift...

Swift 2.0: Let’s try?

When I read the Release Notes for Xcode 7 Beta 6, I got immediately excited by three things, and very confused by the first and most important change in Swift - try?!

Swift 2.0: Protocol-Oriented MVVM

Ever since the mind-blowing Protocol-Oriented Programming in Swift WWDC Session, I’ve been thinking a lot about using protocols. But in reality, I haven’t really been using them as much. I’m still digesting what protocol-oriented programming means, and where in my code I should be using it instead of my other go-to programming patterns. So I was very excited where a HUGE use-case came to mind. MVVM!

Let It Go: Late Initialization of Let in Swift

One of the BIG improvements that came in Swift 1.2 was the ability to initialize let a little bit later. Here is a common use-case for this I have to remember....

iOS: The One Weird Trick For Testing View Controllers in Swift

I’ve been testing View Controllers in Swift for the past year, but for some reason, last week all my tests would just randomly start failing due to some type of timer / race condition issues. Turns out, I was setting up my View Controller tests incorrectly...

iOS: A Beautiful Way of Styling IBOutlets in Swift

This morning I saw a beautiful tweet from @jesse_squires... a really nice way to keep your viewDidLoad much shorter!

Swift 2.0: Understanding flatMap

Finally coming to an understanding with flatMap...

Swift: How To Name Your Extensions

One of my favorite patterns in iOS programming with Swift is to create multiple extensions throughout my files to keep related methods together. The only thing missing from this pattern was that I was unable to name the extensions. Instead, I had to use // MARK: everywhere to keep track of the groupings. I mentioned this to @allonsykraken the other day, and he showed me a simple trick for this – using typealias!

Swift: When the Functional Approach is NOT Right

Yesterday, I spotted what I considered to be a big Swift code smell in the codebase. This immediately screamed out to me as a perfect opportunity to refactor into a functional solution! Wohooo! I get to do functional programming!!! Yes, I was that excited about it...

CocoaPods: The Elegant Solution To Installing The Same Pod In Multiple Targets

One of the most exciting things about Xcode 7 is the ability to natively UI Test (thanks Apple!). So of course that was my priority when I started a new Xcode 7 / Swift 2 project. I really enjoy using Quick and Nimble for my unit tests, so I wanted to use these libraries for my UI Testing as well. Installing Quick and Nimble is easy with CocoaPods. The issue, however, is that you need to install Quick and Nimble only to your test targets.