State of 3rd Party Libraries for iOS
Bratislav Baljak ??
Launch group coaching to scale and minimize your involvement. Each member will get daily support from your mobile app.
In the rapidly evolving world of iOS development, third-party libraries play a crucial role in simplifying complex tasks and speeding up development cycles. By incorporating pre-built and well-maintained community solutions developers can focus on building unique features and spend less time reinventing the wheel.
This blog post will cover some of the most popular third-party libraries in a wide range of categories, highlighting their key features, advantages, and use cases. Let's then take a closer look at the following categories:
Networking
Since its first introduction in iOS 7.0 Apple has gone above and beyond in polishing?URLSession?and its API for all things network related. Today there's not much that we can't do when just reaching for URLSession but when building complex apps which need to deal with things such as complex user sign-in flows, token refreshing, and multipart/form-data then we may want to take a step back and ask ourselves whether it makes sense to delegate these tasks to a hand made solution such as?Alamofire.
Alamofire?is still the de facto king of everything networking related on the iOS platform. It is extremely well maintained and with nearly 40k stars and 7.5k forks on Github it isn't going anywhere any time soon.
Honorable mentions:
Image Caching
When processing large amounts of image data from a remote backend we may want to cache these images, depending on the use case, either on disk or in memory. In such scenarios, we highly recommend reaching for the?Nuke?image loading system.
Nuke?is an extremely well-thought-out library with a high range of capabilities ranging from resumable downloads, request prioritization, smart background decompression, and much more. It is async await and SwiftUI friendly and we couldn't be happier with how this library behaves and performs in our own apps!
Honorable mentions:
Dependency Injection
Dependency injection is usually a controversial topic in the iOS community. Some developers chose to rely on plain old injecting dependencies via the constructor approach while others roll their own solutions for the problem at hand. Here at CocoaCode we found solace in leveraging a library from the folks at?pointfree, namely their?swift-dependencies?library.
This library comes with a set of tools that mirror SwiftUI's environment API, both when registering and reaching for dependencies via the?@Dependency?property wrapper. For those of you who've not heard of this library we won't be spoiling much here, rather let us close this section by borrowing a sentence from their documentation page:
领英推荐
If you are using Date(), UUID(), Task.sleep, or Combine schedulers directly in your feature's logic, you can already start to use this library
Honorable mentions:
Persistence
Nowadays most app's are able to get by just by storing json or plist files directly on disk and calling it a day. In more complex scenarios we may want to reach for battle tested technologies such as?CoreData?or even using raw SQL via the?C sqlite3 interface. Here at CocoaCode we much prefer using the modern and exceptionally well maintained?GRDB?library.
GRDB?is a batteries included lib which sits on top of the SQLite, it has a wide range of features that lets us introduce into our app's an ergonomic and concise persistence layer which is painless to maintain and extend. We highly encourage our readers into exploring for themselves this gem of a dependency by traversing its rich documentation page.
Honorable mentions:
Navigation
In last year's WWDC Apple turned SwiftUI navigation upside down by introducing a whole new set of tools for managing navigation in SwiftUI app's. They deprecated the notorious?NavigationView?and in its place introduced a stack based navigation mechanism in the form of?NavigationStack.
These new API's are, regrettably, not without their warts and here to plug in the gaps and providing ergonomic workarounds are once again the good folks from?pointfree. Their?swiftui-navigation?we consider a must have tool in any SwiftUI app which deals with moderate navigational complexity.
Honorable mentions:
Final thoughts
While (ab)using 3rd party libraries comes with its own set of downsides and maintenance burdens we still consider that these tools do indeed have their rightful place in any serious development group.
We encourage readers to audit any such tool prior to introducing them into their own codebase, taking into consideration whether the libraries are well maintained and thoroughly documented.
Launch group coaching to scale and minimize your involvement. Each member will get daily support from your mobile app.
1 年https://cocoacodeit.com/blogs/ios-3rd-party-libs