When looking at GitHub or searching for solutions, there are many libraries, tools, and frameworks for iOS application development. Still, with iOS being a niche technology, there’s always a problem in assessing whether the solution is worthy of your time.
Stars on GitHub are one metric, but are 500 stars a lot? It is probably a drop in the ocean for web development, but for iOS (with a reasonably small community), it could be enough to interest you in the solution. But there’s no good way to assess the quality of the library just by the number of stars!
Another (probably better) metric is going through well-known iOS community blogs and publishers and looking at what they use or provide tutorials for. Still, there’s a problem: How to assess if the publisher/blogger is considered an expert and popular among the iOS circles? Or maybe the publisher likes the library out of personal preference?
The key to making the best choice for tech is not really about the specific libraries and their popularity but about the underlying concepts they tackle. Sounds unintuitive? It may seem that way, but in this article, I’ll try to prove that once you understand the problems that the library is trying to solve, evaluating them is very easy.
Libraries are critical for iOS development
So let me get straight to the list of iOS-related technologies used in thousands of projects. This list is not exhaustive by any means. It’s a set of prevalent examples among the job offerings and worked well for me.
RxSwift/RxCocoa/ReactiveSwift: This library provides API for reactive asynchronous sequences and bindings to UI. From my experience, about 50% of current projects use that right now, so joining a project is a flip of a coin.
Google Maps/MapKit/OpenStreetMaps: If the application you are working on does have maps in it, it probably uses one of these 3 libraries. I’d argue that you need to know only one of them, as they are similar.
CoreData/Realm: When you want to store data locally, and UserDefaults are too simplistic, iOS offers CoreData as the solution. While there’s nothing wrong with CoreData, and many people prefer it, some prefer Realm as the alternative.
Firebase Cloud Messaging / UserNotifications + APNS: The first one is the whole system made by Google to receive and send notifications. It allows you to send messages by both Push Notifications and Websockets. The second one is Apple’s solution that’s used under the hood by the FCM. The biggest plus of the Firebase solution is that you gain the web socket connection outside of push notifications, and you don’t have to implement the APNS (Apple Notification Service) on your backend from scratch.
Mixpanel / Google Analytics: These two are the staples of event tracking for the applications. If you want to know how users interact with the app, this service allows you to track and gather the data.
Alamofire: This is a go-to library when you need complicated networking. If your networking is simple, sticking to the URLSession is recommended.
Kingfisher/SDWebImage: If you want to display images fetched from the HTTP network and cache them (not download them each time they’re displayed), you can write a ton of code and reinvent the wheel or use one of these. The first one is newer and Swift only, while the latter is an old and proven Objective-C library.
Swinject: If you have a vast application and it’s hard to follow the flow of the object’s creation and how the data is passed around, why not have one place in the code dedicated to all the dependencies?
Fastlane: This is an absolute staple in bringing Continuous Integration to iOS development. As such, it’s worth knowing that everybody needs to publish test builds regularly.
XCTests / Quick&Nible: The first is a library for Unit Tests and UI tests built into the Xcode. The latter allows you to write Behavior-Driven tests. Nimble can also be used with XCTests for simpler, asynchronous, and more expressive asserts.
Except they’re not!
Every library I’ve mentioned tackles a programming problem in its own specific way, but most of the time, they are based on far more general concepts. It’s essential to understand these underlying concepts. I’d argue that it’s the most crucial skill for every iOS developer. Libraries and tech stacks change in a blink of an eye, but the underlying concepts are relatively stable. Many ideas are even from the 70s and 80s! Learn them by heart, and libraries that implement them will instantly be self-explanatory and trivial to assess.
Let’s show a couple of examples:
Swift (or any programming language, for that matter)? Object-Oriented Programming and Functional Programming!
When you learn one programming language, acquiring proficiency in another is a really trivial task. Why? Because the underlying concepts in all languages are the same, and all you need to understand are the differences in the syntax and approach.
If you understand Object-Oriented programming, how encapsulation is achieved in Swift library or how the inheritance works are simple topics. The same rule goes for Functional Programming and questions like “why does the Optional type have a flatMap?” or “why do instances captured in my closure have to be constants, and how to deal with that if I want to change the value?”.
RxSwift/Combine/Reactive Swift? Functional Paradigm, Reactive Paradigm
RxSwift and other similar development frameworks are where knowledge of the Functional Paradigm shines. In my experience, people that don’t know RxSwift often say things like, “Ah, it’s just another library. I’ll learn it on the project as we go”. Sorry to break it down to you, but it’s not, and you won’t. Yes, it is “just a library,” but this requires you to know Functional and Reactive paradigms. Remember how much of a chore it was to learn the Object-Oriented paradigm and understand encapsulation, polymorphism, classes and instances, and all that stuff? Remember how much of a breakthrough it felt when everything finally “clicked”? To be good at RxSwift, you need to have 2 more breakthroughs like that, one for functional programming and one for reactive programming. The same goes for the Combine or Reactive Swift, which are more or less similar.
CoreData/Realm? Relational Databases, Object Databases, ORM, SQL, NoSQL, Repository Pattern
Databases are a vast topic, and it’s elementary to mess it up. While mobile developers don’t have to worry about scalability (there won’t be a million connections to the database on the phone – just one from the user that’s using the device), there are many problems that mobile app developers share with database specialists. The ACID acronym is a good example. Data normalization is another. The ability to directly use SQL queries can also get you far when you have massive datasets. And what if you want to create Swift objects out of these datasets? Here comes the concept of the ORM (while CoreData is more than just an ORM, it can be used as one). And how to decide if the specific information should be fetched from the local database or the backend? Repository Pattern to the rescue!
XCTest, Quick/Nimble? Unit testing and mocking
To correctly write unit tests, you must understand the concept of the test doubles (often wrongly called mocks) and dependencies. Once you see all the problems with dependencies in your code and how hard it sometimes is to fill them in with test doubles, you will quickly see that all of these libraries are self-explanatory! You can also deep-dive into the different approaches to tests! Behaviour-Driven-Testing promoted by the Quick library is a good example.
What should I learn about iOS libraries?
Everybody has their process, so I cannot give you a one-fits-all recommendation, and you should decide on your own. That being said, learning the underlying concepts right after assimilating the very basics of the library itself will guarantee that your knowledge won’t deprecate along with this specific library implementation! And once you understand all the problems in a particular domain, choosing the correct libraries and frameworks for iOS development is easy.
Do you want to know more about libraries and frameworks for iOS development?Talk to us!
One last thing
I’ve mentioned that following blogs is a relatively good way of assessing solutions, so here’s my list. These sources carried me through my career and helped me understand the specific libraries and underlying concepts. This list is non-exhaustive, and I’m more than sure that I’ve omitted some great authors, but I guarantee that if your google search points to one of these sites, it’s worth checking:
- raywenderlich.com | High quality programming tutorials: iOS, Android, Swift, Kotlin, Server Side Swift, Unity, and more!
- Hacking with Swift – learn to code iPhone and iPad apps with free Swift 4.2 tutorials
- Cocoa with Love
- Point-Free: A video series on functional programming and the Swift programming language.
- NSScreencast: Bite-sized Screencasts for iOS Development
- RxSwift Slack
- Stop Writing Swift That Sucks
- Use Your Loaf – iOS Development News & Tips
- Swift by Sundell
- GitHub – JohnSundell/SwiftTips: A collection of Swift tips & tricks that I’ve shared on Twitter
- Yet Another Swift Blog