Natasha The Robot

Currently learning... Swift!

You can follow me on Twitter here.

Subscribe via RSS here.

Subscribe to my Swift newsletter

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.

Xcode Debugging Tip: User Breakpoints

A few weeks ago, I wrote about that one weird debugging trick – using po $arg1 to print those nondescript objc_exception_throw errors. One tip I included was adding po $arg1 as an action to the Exceptions Breakpoint. Here is how you include this breakpoint in all your projects automatically...

Swift 2.0: Why Guard is Better than If

Swift 2.0 comes with the excitement of the guard statement. But looks like there’s still confusion as to why guard is AMAZING, especially compared to the simple if statement before Swift 2.0. That is a completely reasonable question. So why is guard better than just a plane if? Let me count the ways…

iOS: You’re Doing Settings Wrong

One of the apparently less known features for iOS 8 and above is the ability to deep link the user into Settings, where they can enable their Location, Notifications, Contacts, Camera, Calendar, HealthKit, etc for your app as needed...

Swift: Equatable with Optionals

@andrewcbancroft recently wrote a great article about how Every Swift Value Type Should Be Equatable – go ahead and read it, I’ll wait… One thing that stood out as missing from this article was comparing different sets of optional values. In the past, I have implemented the following equality for values to make sure optionals were covered. Turns out, that wasn't necessary...

Xcode: One Weird Debugging Trick That Will Save Your Life

Over the last few days, I've been watching the Advanced Debugging and the Address Sanitizer Session over breakfast. There is one super cool debugging trick that I have to write down so I remember to actually use it.

iOS: An Optional vs Empty Data Source in Swift

So here is a common scenario in iOS development. You're loading a Table View with data from an API. Initially the Table View is blank, since you're still fetching the data, but very soon (hopefully) the data is fetched and the table view is reloaded as it is meant to be. The issue in Swift is how to represent the data when it is initially blank.