Key takeaways for iOS developers from the WWDC 2016 Keynote

As a busy iOS developer, it’s hard to find time to sit down and watch a two-hour keynote, even if it is relevant and important. Here’s a summary of what Apple announced in the WWDC 2016 Keynote as it relates to iOS developers. This covers only what’s relevant to you as an iOS developer; it doesn’t cover watchOS 3, macOS …

Navigating Apple’s WWDC from home

Not going to WWDC? Here’s what you can do next week to keep up with all the important new announcements — even if you can’t take the entire week off to watch the videos from home… ‘cuz let’s face it — we’re all too busy for that. Most importantly, you want to pay attention to the Keynote and the Platforms …

How do you unit test REST calls in Swift?

In the Live Q&A chat Christina and I hosted a few weeks ago on GrokSwift.com, Steve asked about the best way to unit test REST API calls. Here’s his question: Can you talk about the right way to unit test rest calls? What are the best tools for just testing endpoints? I love this question — probably because I love …

Recipe: Using Anchors to Place Views in iOS

I just learned anchors for placing views in iOS, and they totally blew my mind. If you’re setting any auto layout constraints programmatically with NSLayoutConstraint’s constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:, you know how ugly and verbose it can be –​ and you definitely want to check out anchors. Want to center your segmented control horizontally 20 points from the top of the view? Forget …

Avoid using class names in Swift’s #selector

Don’t use class names in Swift 2.2’s new #selector. In other words, don’t do this:

Here’s the problem: it compiles, so you’d expect it to work, right? Isn’t that what #selector is all about? But let’s say you decided to refactor this code out of MyViewController and into a child view controller called MySecondViewController. (This just happened to me, …

Tiny Swift Tip: Initializing Empty Arrays

If you’re initializing your empty arrays by specifying the type annotation like this… Hold on — what’s a type annotation? Great question. You use them all the time when you define methods that have at least one parameter:

The : Int is the type annotation for the id parameter. A type annotation starts with a colon and ends with …

How to handle null JSON values in Swift

A Parsing JSON in Swift reader recently wrote in and asked: I did have a question regarding getting a null value in your JSON. I know null is different than a nil value so I didn’t know how to go about safely receiving it? So what do you do if you get a null value in your JSON? How do …

Debunking the myths about parsing JSON in Swift

There are a bunch of myths out there about parsing JSON in Swift. And the problem with these myths is that they lead us to solve imaginary problems using bloated frameworks or wacky techniques that gain us very little, especially considering the cost they impose on us. Here are a few of the most popular myths — and the truth …

Year in Review 2015: The Year of Parsing JSON in Swift

I enjoy reflecting and writing these articles each year, and while I write them for myself, others have told me they enjoy reading them. If you missed previous years, you can find them here: 2014: What I learned about building an audience, selling products, and productized consulting 2013: What I learned from launching one failed and one successful product (and …