Improving Swift Compile Times

Let’s face it: there’s a limit to how much fun you can have while you’re waiting for code to compile. (via xkcd.com/303/) At some point, enough is enough. Our team has had enough fun compiling Swift code over the past year that we’ve incorporated the following into our project so we can spend less time compiling and more time working. …

How to parse JSON with Swift 3

Why is it so hard to parse JSON in Swift? I can’t count the number of times I’ve seen or heard this question since Swift came out. So what’s the problem? Shouldn’t a real programming language make it super simple to work with JSON since everyone uses it everywhere? The issue is that we’re taking weakly-typed JSON data and transforming …

Cut your Swift build times in half with this one weird trick

(I’m not apologizing for the clickbaity title since it actually works and it is a little weird…) I’ve been working on improving Swift build times off and on for the past few weeks, and today I stumbled across the best possible improvement: a one-line change that cut our build times in half. I noticed in our build logs that all …

Testing asynchronous code in Swift with XCTest expectations

Testing asynchronous callbacks in your Swift code? Try this:

Consider using OHHTTPStubs or just stubbing manually to make this run faster. (Note that result is a simple Result enum like Rob Napier describes in Functional Wish Fulfillment.)

WWDC 2016 podcast episodes for iOS developers

I enjoy listening to podcasts when I commute, and I especially love hearing different people’s thoughts, opinions, and recommendations on what to do as a result of the new announcements at WWDC. Here are some of the WWDC 2016 podcast episodes I’ve enjoyed, followed by a few that are still on my list. If you’re looking something to listen to …

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 …