Popular iOS Development Instruments
Integrated development environments
There is a limited number of IDEs to develop for iOS: Apple’s Xcode, AppCode, Xamarin.
Xamarin is a cross-platform mobile app development IDE, but you should know C# to start developing with it: it doesn’t support iOS native languages: Objective C and Swift.
AppCode is the IDE from JetBrains with Swift and Objective C support, but you should have Xcode installed anyway to work with AppCode.
So if you want to start developiung native iOS applications you should download Xcode.
iOS developer tools
There is a number of instruments provided by Apple that can help you in the development process. Let’s take a look at some of them.
We can breakdown the most commonly used instruments into 3 groups by their purpose:
Detecting memory management issues
- Address Sanitizer
- Time Profiler
- Core Data
Detecting memory management issues
During development process we have deal with iOS memory management. And there are some memory management issues a developer can face:
- Memory leaks: the situation when memory is allocated for an object and is not freed after the object is no longer in use. Can occur when 2 objects have strong pointers at each other. The Leaks instrument can help you determine such kind of issue.
- Memory usage growth or usage of large amount of memory. This situation can lead to terminating the app by iOS (crash). To estimate and optimize memory usage in the app you can use both Allocations and Leak instruments.
- Addressing to deallocated memory will also lead to a crash. Zombies and Address Sanitizer can help here.
Address Sanitizer is not a standalone instrument, but integrated into Xcode. Just check “Enable Address Sanitizer” in the Diagnostics tab of your current build scheme in Xcode, re-compile and run the project.
- Addressing the memory out of bounds of the memory allocated for the object. The situation when you write to a memory, which is out of bounds of the object you access to, may not lead to a crash, because it can be a memory block allocated by you for another object. But it can lead to an unpredictable behavior of the app or to weird single crashes in different places of your app. Use Address Sanitizer to debug such situations.
Address Sanitizer will stop app execution on any attempt to write to the memory which isn’t belong to the object you access too and will show the stack trace which will help you to determine the reason of the issue. Don’t forget to disable “Enable Address Sanitizer” option when it is no more needed, because memory consumption may grow up to 3 times when using Address Sanitizer.
When you operate with a large amount of data in your app, the performance should be taken into account.
You can use Core Data instrument to track the performance of your app’s operations with database. You’ll see how many fetches and saves the app does at a time, operations duration, cache misses statistics. It will help you find performance bottlenecks and decide how to optimize your requests or Core Data model itself.
With Time Profiler instrument you can track CPU usage of every single method in your app. This may help you to find inefficient or broken algorithms. Time Profiler has very convenient options to explore a call tree: “Separate by Thread”, “Invert Call Tree”, “Hide Systems Libraries”, “Flatten Recursion”, “Top Functions”.
When we make changes in our app we should ensure that the changes haven’t broken our app and the app works as expected. So we cover all classes and methods with unit tests. But we can also test the UI behavior with the Automation instrument.
Go to Xcode and select “Profile” from the “Product” menu. Then choose “Automation” in the appeared Instruments window. Here you can write scripts for UI tests. By the way the Automation instrument can record user interactions and convert them to a script. So all is left to you just to write some lines of code to verify the expected results.
Tap “Play” button and the Automation instrument will launch the app and perform the UI test replaying all your interactions.