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 …

How to refactor your Swift code using TDD

Are you sold on the benefits of unit testing and TDD but stuck trying to introduce it into your code base? With today’s video, you’ll learn how to use TDD to reduce duplication and refactor a class to make it easier to maintain. You’ll notice that TDD helps to evolve the design of the code and improve the overall structure, …

Automatically resolving git merge conflicts in Xcode’s project.pbxproj file

If you’re like me, you hate manually resolving merge conflicts in Xcode’s project.pbxproj file every time both you and one of your teammates add a new file to your project. It’s an “easy” merge in a sense – you always want to keep both sides – but somehow git can’t figure it out. Here’s how to make git merge those …

How to get components from a date in Swift

I had the hardest time figuring out how to create NSDateComponents from a date in Swift. How do you tell NSCalendar which units you want? You can’t do what you’d do in Objective-C… I eventually stumbled across a solution. Here’s how to get components from a date in Swift, specifying the NSCalendarUnit flags: let date = NSDate() let unitFlags: NSCalendarUnit …

Why not make the ViewModel the table view’s data source?

Last week, after watching the first video of the Beginning Swift course, Christina asked: Why not make the ViewModel the table view’s data source? First, some context: we built a single view app with a table view using the MVVM pattern, and the table view’s data source is the ViewController, not the ViewModel. So what do you think? Why shouldn’t …

Notes from WWDC 2015: Cocoa Touch Best Practices

Keeping up with the latest best practices is important, but when you’re working full time, it’s hard to find the time to do it. You either have to make time during the work day when you’re already overwhelmed or make time during your nights and weekends when you’d really prefer not to be working. I was able to make some …

How to use typealias to make JSON parsing more readable in Swift

Update: If you’re using Swift 2, check out How to parse JSON with Swift 2 to see how to handle JSON in Swift 2. The typical approach I’ve seen to JSON parsing in Swift with [String: AnyObject] dictionaries is fine, but not all that readable. Let’s see if we can fix that, making it a little easier to understand and …