SwiftUI Weekly - Issue #28
The curated collection of links about SwiftUI. Delivered every Monday.
News
iOS 14 Adoption Surpasses 25% Across iPhone and iPad Five Days After Release
Five days after Apple released iOS 14, adoption of the software update has reached approximately 26 percent of active iPhone, iPad, and iPod touch devices, according to mobile analytics company Mixpanel. This includes iPadOS 14.
Swift 5.3 released!
Swift 5.3 is now officially released! 🎉 Swift 5.3 continues to focus on language refinements, the developer experience, and expanding the Swift ecosystem to enable more opportunities to write Swift.
Reading
Tabs and pages in SwiftUI
This week we will talk about creating tabs and pager views in SwiftUI. TabView gained superpower during WWDC20. We can now use it across all the Apple platforms to build tabbed and paged user experiences with SwiftUI out of the box.
Impossible SwiftUI views
When defining a SwiftUI view, it comes automatic to write struct MyView: View followed by var body: some View { ... }: all our views are composed by other views, but at some point SwiftUI needs to draw something on the screen: when does it end? How does SwiftUI know that it has reached the bottom of a view hierarchy?
Building a Collection For SwiftUI - Mimicking Collections in SwiftUI
SwiftUI does not offer any full-featured collection component like UIKit does, merely smaller building blocks like stacks, lists and scroll views (as well as lazy stacks and grids newly introduced in iOS and tvOS 14). In isolation none of these components is a true competitor to UICollectionView but, combined together, they can be used to build pretty advanced grid and table layouts.
Building a Collection For SwiftUI - SwiftUI Collection Implementation
Faced with the inability to reach an acceptable level of performance with grid layouts made of simple SwiftUI building blocks, I decided to roll my own solution.
Building a Collection For SwiftUI - Fixes and Focus Management
In part 2 of this article series we implemented a first working collection view in SwiftUI, powered by UICollectionView. This implementation is promising but still has a few issues and shortcomings that we will address in this final article.
Build a Twitter-Inspired Animated Like Button in SwiftUI
A fun, animated, heart-shaped like button
Code
SwiftUI-SharedObject: A new property wrapper for SwiftUI ObservableObject.
@SharedObject is an alternative way to @StateObject, @ObservedObject, @EnvironmentObject for handle ObservableObject. The problem is that with @StateObject the object will deinit with the view, with @EnvironmentObject you can bind only one instance of the same class for each Environment.
@SharedObject simply stores the objects using an identifier, so you can retrieve it each time you'll need it.
DeckKit
DeckKit is a tiny SwiftUI library that can help you create deck-based apps. With DeckKit, you can create decks of any model that implements CardItem and present them in various ways.