Regardless of the readiness of this amazing framework, it is clear that SwiftUI will be the future of the Apple platforms. Each year, the framework gathers strength and overcomes challenges that only UIKit could handle. There is no better time to start mastering your skills. Check out this resource compilation and use it wisely to enhance your skill set.
One of the greatest advantages of SwiftUI is its cross-platform capability, but building a cross-platform application is no easy task. What sort of things can be good to keep in mind when using SwiftUI in a cross-platform context? Have you ever heard of Orbit? Malin Sundberg joined this podcast to tell us about her experience of using SwiftUI to build this time tracking and invoicing cross-platform application that runs on most of Apple’s platforms.
We are in favor of reusability, so what happens if we would like to reuse our SwiftUI views in a different project? We could just copy the code, right? That would make the maintenance very inefficient. Worry not; take a look at how to Share SwiftUI views Using Swift Packages.
We hope you have a great time learning about all the advantages SwiftUI brings and we look forward to what's coming next with this framework.
WWDC21 Extras & Concurrency Follow Up
Last month, we gave you some highlights of WWDC21 to look into. But because there is so much to cover, here are some extra interesting reads we found.
Let’s start with UICollectionView and UITableView. Diffable data source behavior changed and, from iOS 15 onward, applying a snapshot using the new API will always perform a diff. Take a look at these significant changes and improvements.
Concurrency was talked about at length at this year's WWDC. Allowing multiple pieces of code to run at the same time is great, but what if we want to declare a piece of code asynchronously and await its result? Here are some code examples of how to get this done.
We also mentioned Actors in our previous highlights edition. As there is so much to say about this, we want to share a couple of extra articles. First, let’s catch up with how Actors work internally in Swift. This is a newly added feature that allows us to deal with asynchronous code. Equally important is MainActor, a core new attribute introduced in Swift 5.5 as a global actor providing an executor which performs its tasks on the main thread. Avenderlee posted this nice article about MainActor.
Dependency injection is a powerful design pattern we use quite commonly. It allows us to reuse code and simplify testing. Most of the time, this pattern is implemented using third party libraries — great for a quick start but sometimes, implementing it yourself could be the best solution. Avanderlee has a great example of how to accomplish this using the latest Swift features.
Have you heard of Mutating and Non-mutating Swift contexts? This is a cool one. Swift by Sundell explores the usage of “mutating” and “non-mutating” keywords. To take it a bit further, take a look at this discussion that arose from the use of mutating.
That’s it for July! Hope you enjoyed the updates, and see you next month!