SwiftUI Weekly - Issue #103
The curated collection of links about SwiftUI. Delivered every Monday.
News
Update to subscription notifications
With this update, under certain specific conditions and with advance user notice, developers may also offer an auto-renewable subscription price increase, without the user needing to take action and without interrupting the service.
Reading
Modeling errors in Swift
The new Swift Concurrency feature doesn’t only bring new opportunities for writing safer and more maintainable async code but also changes the way we handle errors. I didn’t use throw-catch keywords too much in my legacy code because usually, I had a completion callback with the Result type handled by the switch operator. This week we will talk about modeling error types and how we will address them in Swift with throw-catch keywords.
The SwiftUI render loop
Just like UIKit, SwiftUI is implemented on top of an event loop that dispatches messages to your UI code. The UI code in turn may trigger parts of the screen to be re-rendered. The handling of messages and rendering of graphics on screen form the render loop of an application. All UI frameworks are based on a render loop, in SwiftUI it is hidden particularly well. Most of the time, it works under the hood without us needing to know anything about it. It is amazing how we can write UI code without even needing to understand what an event loop is, and without us needing to worry about how often to render screen content. But in some cases, it is useful to know what is happening behind the scenes.
SwiftUI Still Isn’t Production-Ready
SwiftUI is simply fantastic. It’s a great way of producing applications quickly, and seems to be the future for creating iOS applications. Previews are fantastic, and the speed of production seems unparalleled.
Encode and Decode SwiftUI Color
Add custom encoding and decoding logic for SwiftUI Color that is not Codable by default to be able to save it to disk or remote database.
How to use custom fonts and images in a Swift Package
Create a SwiftUI design system module with custom fonts, reusable components, and working Xcode Previews.
How to add section header and footer to SwiftUI list
We can group related data in a SwiftUI list using Section view. We can also optionally add a header and footer to describe a particular section. Let's learn how to do that.
Animations in SwiftUI with examples
Hi guys, today we are going to explore how we can implement animations in SwiftUI. The full source code of this project is available on Github, feel free to fork or directly use required animations in your applications.
Code
Swiftcord
A completely native Discord client for macOS built 100% in Swift and SwiftUI! - GitHub - SwiftcordApp/Swiftcord: A completely native Discord client for macOS built 100% in Swift and SwiftUI!
Video
Breaking down the SwiftUI App Lifecycle
In this video, we will look at the SwiftUI App Life Cycle. We'll look at how to trigger events when our apps enter the screen, and how we can modify the UI of our views, we'll look at the onAppear modifier, onDissapear modifier, and onChange modifier as well.