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 …

Reducing clutter in your JSON parser through proper typing

This article is an excerpt from Parsing JSON in Swift. When you’re casting types as you parse your JSON, be as specific as you can to reduce clutter. This is especially important when working with arrays, which generally contain just one type. Let’s look at how we might parse the following JSON (from the GitHub Search Repositories API):

For …

How to test your JSON parser

Earlier, we discussed why you should test your JSON parser and how it can save time, catch bugs, and help you build confidence that your code does what you want. But how do you write tests for your JSON parser? And should you make network requests to the API in your tests? Let’s answer the second question first. Should you …

Why test your JSON parser?

One of the big benefits to creating a separate JSON parser class is that we can write automated tests for it easily. But why would you want to write tests? What benefit could they possibly provide? Unit tests provide at least five main benefits: they help you ensure correctness during development, catch bugs in existing features, allow you to refactor …

APOD App Rejection: Postmortem

My heart sank when I saw the little red dot in iTunes Connect. Apple had just rejected my app. I spent a good portion of my free time during the previous five weeks building my app for the new Apple TV and submitted it just ten hours after they opened submissions. (If I hadn’t been sleeping, I would’ve submitted it …

How to parse JSON with Swift 2

I’ve written about how to parse JSON in Swift before, but someone asked recently about how to do it with Swift 2 and I realized that everything changed from Swift 1.2 to Swift 2.0. So how do you parse JSON with Swift 2? We’ll look at how to parse a JSON array that we could use to display a list …

Notes from WWDC 2015: Building Watch Apps

If you were too slammed to pay attention to WWDC this year, you can get a quick overview of how to build apps for watchOS 2 with the notes below. The Building Watch Apps session from WWDC 2015 is essential for digging in to how development works in watchOS 2. It’s changed significantly from the first version of watchOS, so …

Which books should I get to learn iOS?

You’ve watched plenty of YouTube tutorials on iOS development but feel like you’re not really learning what the code does. Sure, you can write a bit of Swift, but you want to dig deeper to learn how and why the code works. Which books should you use to actually learn iOS so you can build your own apps from scratch? …

How to enable and view test coverage reports in Xcode 7

Want to take advantage of Xcode 7’s new test coverage reports but don’t know where to find them? Below is a step-by-step process for enabling and viewing test coverage reports in Xcode 7. Enable Test Coverage If you want to see code coverage reports, you need to enable test coverage data on your main target. You’ll need to edit the …

How can you do TDD with Swift?

If you haven’t done TDD in a compiled language like Swift before, you may be wondering: How can you do TDD since your code won’t compile if the objects your test references don’t yet exist? An interpreted language like Ruby or JavaScript may feel like a more natural fit for TDD than a compiled language like Swift since you can …