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:

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 …

How to get Xcode to stop generating copyright headers on your Swift files

I’m tired of having Xcode’s auto-generated copyright headers in my files. They’re totally unnecessary and just add clutter to my code. And I hate clutter. Here’s how to get rid of the clutter and make your Swift files clean. (Thanks to Anthony for laying the foundation for this.) Create a new User File Template Quit Xcode. Bad things may happen …

The Best Resources for Getting Things Done with iOS Development

You’ve learned enough iOS development to build a master-detail app, and you can build table views without much trouble. But where do you go if you want to add in-app purchase to your app? How do you find the code you need to add maps, or Apple Pay, or HealthKit to your app? You could search with Google (DuckDuckGo?) or …

Top 10 things you need to know from WWDC 2015 as an iOS developer

or: How Xcode 7, Swift 2.0, and iOS 9 can help you build better iOS apps If you don’t have time to watch the all the WWDC 2015 videos to find out what’s happening with Xcode 7, Swift 2.0, and iOS 9, read on for a quick summary of what you – as an iOS developer – need to know …

How generics in Swift can lead to safer, cleaner code

If you’ve never done generic programming before, you may be scratching your head wondering “why would I ever do that?” Or maybe you’ve looked at generics and thought “what’s with all those pointy brackets?” In this article, we’ll look at why you’d want to use generics in classes, structs, or enums you define, and hopefully by the end you’ll have …