Xcode
Testing push notifications in the Simulator with Xcode 11.4
Published on: February 12, 2020For years we've had to resort to using physical devices when testing push notifications. With Xcode 11.4, Apple finally gives developers the tools needed to test push notifications on the iOS Simulator. I'm going to assume you already know how to add push notifications to your app. If you've never added push notifications to an app before, I have a post that describes how to set up and test push notifications without a third-party service. That post should get you all set up to follow along with this post. Sending a test push from the command line Xcode comes with...
Read more...Five tips to write better todos in Xcode
Published on: January 8, 2020We all write the dreaded // TODO: and // FIXME: comments every once in a while. Sometimes we do it because we know our code can be better but we're not sure how, other times we don't have the time to write an optimal solution because of deadlines, and other times we just want to move on to more interesting problems to solve and we just slap a // TODO: on our code and call it a day. In today's post, I would like to give you five tips to make sure your todos eventually get fixed and don't end...
Read more...Dependency injection with Storyboards and Xcode 11
Published on: December 23, 2019For years I have had a bit of a love and hate relationship with Storyboards. I love how easy they make it for me to set up my AutoLayout constraints, but they can quickly grow unwieldy and for large projects with multiple developers Storyboards are hard to use because of merge conflicts that occur when multiple developers update the UI. For personal projects, however, my Storyboards tend to be small enough to manage. And since I'm the only developer working on them I never have merge conflicts. Yet still, I've never been completely happy with them. The main reason for...
Read more...Installing multiple Xcode versions with xcversion
Published on: December 18, 2019As a developer that uses Xcode on a daily basis for multiple projects, you sometimes need to use different versions of Xcode depending on the project you’re working on. Or maybe you want to try out the latest Xcode beta, for example right after Apple announced it after WWDC. One way to manage is to go to the Apple developer portal, searching for the version you need and download it. You download the .xip file, expand it (eventually, it takes a while) and then you can finally open Xcode. But then you realize you also have to rename it before...
Read more...Using Xcode’s memory graph to find memory leaks
Published on: December 9, 2019There are many reasons for code to function suboptimally. In a post, I have shown you how to use the Time Profiler to measure the time spent in each method in your code, and how to analyze the results. While a lot of performance-related problems can be discovered, analyzed and fixed using these tools, memory usage must often be debugged slightly differently. Especially if it's related to memory leaks. In today's post, I will show you how to use the Memory Graph tool in Xcode to analyze the objects that are kept in memory for your app, and how to...
Read more...Configuring projects with xcconfig
Published on: November 13, 2019Sometimes you want to be able to install two versions of your app side by side, for example, a development version and a release version that show up as individual apps by giving them different bundle identifiers. And maybe they should also use different versions of your REST API depending on the type of build you're using. In this week's Quick Tip I will show you how you can manage this using xcconfig files. Creating and using your xcconfig file To create an xcconfig file, choose File -> New -> File... in your project. In the new file dialog, scroll...
Read more...Enforcing modular code with frameworks in Xcode
Published on: July 17, 2016Every iOS developer I know dreams of writing code that’s DRY, modular, testable and reusable. While this is a great goal to strive for it’s often quite hard to write code that is completely modular. It just takes one oversight to blow most of the modularity you have achieved right out the window. One technique that people use to make it easier to write modular code is to try and ensure that a certain part of their code, for instance the networking logic or their models, know nothing about other parts of the app. Again, a great idea but this...
Read more...Clean derived data from Xcode, the simple way
Published on: February 26, 2016Update for Xcode 11: Unfortunately, it appears that this method of cleaning derived data no longer works😕. Looks like we're stuck purging ~/Library/Developer/Xcode/DerivedData/ by hand again. If you do know of a workaround similar to the one described here, send me a tweet and I'll update this post! Any iOS developer that has spent significant time with Xcode is familiar with at least a couple of it's caveats. Random crashes, slowness, autocomplete not working for a few seconds and build errors right after you've added or removed a library. Or, just a random appearance of 200+ warnings like I had...
Read more...