Some of the most common questions that we, as iOS Developers, ask ourselves while playing with some fancy application are: "How did they do this?" or "What libraries have they used?" and so on. In a world full of deadlines and time constraints we usually don’t have a chance to do experiments outside of working on our commercial projects. In this series of articles, we will focus on various aspects of introspection and reverse engineering in the field of iOS app development to provide insights about implementation details of various features present in today's top iOS apps.
The announcement of Swift was probably the most unexpected event of the whole WWDC 2014. After years of commitment to Objective-C, Apple decided to roll out a new modern programming language to ease the work of thousands of iOS developers and bring the quality of iOS apps to a new level. Of course, even for Apple, it was impossible to release a complete product like a programming language and its runtime that would satisfy everyone and instantly supersede Objective-C. And so, for over a year Swift has reached a version 2.1 on its way to becoming an ultimate programming language for the entire ecosystem of Apple's products. Recently, Apple open-sourced Swift's core codebase and started to accept contributions from developers around the globe, thus showing once again its dedication to the new language.
But, the language itself is only the tip of the iceberg. The system runtime libraries provide means for an app to actually do something and this is where troubles start to emerge for a rapidly changing language. With every change in the language, its runtime libraries must be updated too. In this case, if language-related system runtime libraries were stored on the operating system itself, it would be impossible to run an app written using the newer version of the Swift language than the one that existed when the particular operating system was released.
Apple's engineers chose another approach. Right now during compilation, a Swift app is linked to a set of dynamic libraries that represent Swift runtime of a required version. Such an approach allows us to compile apps that will run on older versions of iOS at the cost of increasing the size of each app. It is thus easy to find out whether or not an app was written using Swift or not by inspecting its dynamic libraries dependencies.
The otool is a very helpful introspection command line utility. Using it we will see how many top iOS apps are written using Swift by checking whether the app binary is linked to libswiftCore library like this:
Another interesting topic related to dynamic libraries is dependency management. The principle of not inventing the wheel encourages us to integrate ready-made solutions be they either open- or closed-source in our projects. In iOS 8, Apple introduced a long-expected support of dynamic libraries (aka dynamic frameworks) that allow us to store binary with a required code along with required resources in a self-contained package. The popular dependency manager CocoaPods introduced support for third-party dependencies in Swift and dynamic frameworks in version 0.36. Another trending dependency manager, Carthage, supports only dynamic frameworks. Utilizing the same approach that helped us to detect whether an app uses Swift, we can check what third-party framework dependencies an app has:
Recently, Apple has published a list of Top 25 Favorite iOS Apps Of The Year for both iPhone and iPad in the US App Store. It will be interesting to see how many of those apps are using Swift and Dynamic Frameworks, but before we start to inspect those apps we need to obtain their IPA files or binaries. Previous to iOS 9 an application's IPA file could be extracted from the phone's backup using third-party software like iMazing but since the introduction of iOS 9, Apple removed the option to backup applications . The only way left is to jailbreak a device to obtain root access to its file system and extract required binaries from /var/mobile/Containers/Bundle/Application folder. With that being said, let's move on to the results.
1.3.1, iOS 7.1+, initially released on Mar 26, 2015
Holding the title of Apple's favorite app of the year, Periscope is an innovative live video streaming app by
1.2, iOS 8.1+, initially released on Mar 12, 2015
Being an advanced and feature-rich photo editing tool, Enlight provides more than just a set of predefined photo adjustment filters. With a variety of in-app tutorials and a sleek user interface, this app will be a valuable asset even for an amateur photographer. Enlight was also built without Swift and the only Dynamic Framework it contains is Masonry - an AutoLayout helper library. Creators of Enlight have also put the titles of other non-dynamic libraries that they have used at the app's section in Settings app. Thanks to this we can see that this app also relies on SVGKit, MAKVONotificationCenter, Facebook SDK, libextobjc, OpenCV, and AFNetworking.
5.2.1, iOS 7.0+, initially released on Dec 11, 2014
Nominated as a runner-up in the top 25, Robinhood also won a 2015 Apple Design Award earlier this year.
1.4.2, iOS 8.0+, initially released on Nov 20, 2014
Workflow lets you build sequences of various actions and automate many redundant tasks like file uploading. Even though Swift wasn't used during creation of this app it contains Dynamic Frameworks of third-party libraries such as Aviary, Mantle, pop and Realm.
7.12, iOS 7.0+, initially released on Oct 6, 2010
A famous photo sharing app thast got a "Best App on iPhone 6s" title for its vast 3D Touch usage, Instagram is the fifth app in the list that doesn’t use Swift or Dynamic Frameworks.
1.4.0, iOS 7.0+, initially released on Apr 6, 2015
With this app, you can watch all of the content from the HBO network for $14.99 a month. As was the case with the previous apps, neither Swift nor Dynamic Frameworks were not used in the development of this app.
2.2.0, iOS 8.0+, initially released on Jan 27, 2015
A must-have app for those who wish to save some money on airplane tickets, Hopper will analyze price
2.4, iOS 8.0+, initially released on Feb 12, 2015
Another photo-editing app. Like Enlight, it allows users to quickly apply a set of predefined filters to a photo.
2.3.0, iOS 8.0+, initially released on Sep 29, 2014
Lark is a personal weight-loss coach with A.I. and voice recognition. Lark makes analyzing your physical activity easier by using various types of charts to show the data. Swift wasn't used during the creation of this app and it doesn’t contain any Dynamic Frameworks either.
1.0.4, iOS 8.0+, initially released on Aug 18, 2015
The Everything Machine is a visual programming app that lets kids build virtual machines from various blocks like phone sensors and logic gates. Swift was used during the development of this app, but no third-party Dynamic Frameworks were found.
1.5.1, iOS 8.0+, initially released on Mar 12, 2013
Pacemaker makes DJ'ing easy and fun. Take your favorite music from your Spotify or Apple Music accounts,
1.5, iOS 7.0+, initially released on Feb 20, 2015
What can be a better way to learn a foreign language than to speakit with its native speakers? Using Tandem
1.9, iOS 8.0+, initially released on Jul 21, 2015
Jet is a shopping app for the U.S. that lets you find the lowest prices for a wide range of products. Built with Swift, Jet is also packed with Dynamic Frameworks among which we can see such third-party solutions as
2.0.4, iOS 7.1+, initially released on Jan 15, 2015
As its name says, Timeline lets you browse through the sequence of events that preceded a recent news story. Its sleek user interface makes reading and navigating through the stories a joy and ensures that you will visit this app again. No third-party Dynamic Frameworks were bundled with Timeline besides the Swift runtime which means that Swift was used during the development of this app.
1.6, iOS 8.0+, initially released on Jun 5, 2015
A video editing app that lets you quickly shoot video clips, add transitions, filters, or soundtracks. What's
2.0, iOS 8.0+, initially released on May 9, 2015
To stay healthy, people must pay attention to the food they eat. With Fit Men Cook this task becomes a lot easier, as it contains over 150 healthy and practical recipes with easy-to-follow instructions. Even though third-party Dynamic Frameworks weren't found in this app bundle, a presence of Swift runtime clearly shows that new language was used during the Fit Men Cook development.
1.4.0, iOS 8.3+, initially released on May 29, 2015
Spark makes email a piece of cake. Its Smart Inbox automatically sorts your messages into various categories so that you will not have a hard time browsing through tons of new emails. Huge customization capabilities of this app, along with gesture support, will definitely make you more productive with email. Spark wasn't created using Swift, nonetheless, it bundles three Dynamic Frameworks, none of which are open source.
5.2, iOS 7.0+, initially released on Aug 31, 2012
A must-have app for everyone writing essays, reports, or other academic papers. RefME helps you to quickly create a properly formatted reference by scanning a barcode of a book or a journal. It supports over 7000 reference formats, so you will definitely find the one that you need. Developers of RefME used Swift, but didn't integrate any third-party dynamic frameworks.
2.0.8, iOS 8.0+, initially released on Aug 31, 2012
Wildcard is a news app with an awesome user interface that lets you quickly glimpse through the news by showing them as 2-3 sentence cards. Wildcard wasn't built using Swift and it doesn't bundle any Dynamic Frameworks.
3.4.2, iOS 8.0+, initially released on Mar 14, 2012
Paper is definitely not just another note-taking app. Its beautiful gesture-oriented user interface combined with an advanced drawing tools brings note-taking to a new level as not only ordinary text can be stored, but also handwritten sketches. Even though Paper doesn't use Swift, it is heavily packed with Dynamic Frameworks. Authors of Paper explicitly mentioned the used third-party libraries at the Acknowledgements page in the Settings app, among which there are: AFNetworking, Boost, InAppSettingsKit, MTLabel, OAuthCore, Cinder C++, SDURLCache, TTTAttributedLabel, UIAlertView-Blocks, ZipArchive, Facebook iOS SDK, Bolts Framework, Parse SDK, Eigen, WeView2, TransitionKit, MixPanel iOS SDK, and LZ4 Library.
2.0, iOS 8.0+, initially released on Aug 20, 2015
Giphy cam is a photo app for quick GIF creation. Shoot a video, add funny overlays, and quickly get a GIF to share it wherever you want. Doesn't use Swift or Dynamic Frameworks.
1.1.0, iOS 6.0+, initially released on Oct 1, 2014
Being a mix of a game, a book, and a movie, PRY represents a new way to experience a fiction story. Even though it was developed without Swift or Dynamic Frameworks, PRY is still worth checking out.
1.6.2, iOS 8.0+, initially released on Feb 4, 2015
Reuters TV: Video News is a personalized video news app. With Reuters TV, you can set how much time you have, select a news topic of your interest, and the app will present you a range of news videos that satisfy the mentioned criteria. No Swift or Dynamic Frameworks were spotted in this app.
1.10.0, iOS 8.0+, initially released on Sep 26, 2014
Zova is an app with a set of easy-to-follow video workouts for women. Besides the videos themselves, Zova also provides scheduling functionality so you will be able to easily do a workout session even with a busy lifestyle. Swift was used during the development of Zova's current version, but third-party libraries, if there are any, are not stored as Dynamic Frameworks.
1.1.2, iOS 8.0+, initially released on Jul 15, 2015
Blue Apron is a greatly illustrated cooking recipe app. Besides recipes, Blue Apron also provides a food delivery service, letting you prepare great meals without grocery shopping. Developers of this app used Swift, but third-party Dynamic Frameworks were not found in this version.
After reviewing the top 25 list of apps, we came to the following conclusions. Swift was used during development of only 8 out of 25 apps, even though the first versions of 15 out of 25 apps were released in 2015. 17 out of 25 apps specify iOS 8 as a minimum-supported OS which clearly shows that the support of iOS 7 will soon cease in development most of the apps. At the same time, none of the mentioned apps set iOS 9 as a minimum version. When it comes to third-party dependencies it is clear that most of the apps still compile them as static libraries instead of dynamic frameworks. It's really great that developers of Vee for Video and Paper apps decided to list all of the third-party dependencies they used on their acknowledgements pages, as this helps to spread the word about such solutions and makes them more popular.
At MLSDev, we always use the best tools to develop projects for our clients. We started to use Swift in production projects in Spring 2015 and since then have gained great experience in this modern and rapidly changing language. Our team wishes you a Merry Christmas and a Happy New Year! See you in the next year!
This article was written by Rostyslav D of MLSDev.