SwiftUI Weekly - Issue #203
The curated collection of links about SwiftUI. Delivered every Monday.
Deep Dive into Environment in SwiftUI
SwiftUI revolutionized app development with its declarative syntax and reactive data handling, making it easier to build dynamic and responsive user interfaces. At the heart of this framework lies the @Environment
property wrapper and its related tools, which provide a seamless way to manage shared state across views.
Mastering TextEditor in SwiftUI: Features, Limitations, and Tips
One of the most commonly used views in iOS apps is an editable text view. It's a versatile element that can be used for various purposes: leave a comments on social media, create a note, or even write a code. SwiftUI has a basic view for long-form text editing — TextEditor
.
Preview SwiftUI views with bindings using @Previewable
Xcode 16 introduced the Previewable macro, making it easier to preview SwiftUI views with bindings. By annotating dynamic properties like @State
in a #Preview
body with @Previewable
, we can pass them as bindings to views directly.
Understanding SwiftUI's View Update Mechanism: Starting from a TimelineView Update Issue
In SwiftUI, the automatic view update mechanism allows us to easily build responsive user interfaces. However, sometimes views may not update as we expect. This article explores SwiftUI’s view update mechanism through a seemingly simple but representative TimelineView
update issue.
How to identify data in Lists and ForEach in SwiftUI
In SwiftUI, creating dynamic and responsive views often involves generating content from collections of data using List and ForEach. To efficiently manage these dynamic views, SwiftUI needs a reliable way to identify each item in the collection. When the data is uniquely identifiable, SwiftUI can easily track changes, remove items, and insert new views. This is where the Identifiable protocol and the \.self key path come into play.