SwiftUI Weekly - Issue #233
The curated collection of links about SwiftUI. Delivered every Monday.
Scheduling and handling background app refresh in SwiftUI
Background tasks let apps perform work outside their normal execution cycle, without the app being in the foreground. They are useful for keeping application content up to date, completing deferred work, or performing maintenance tasks without requiring the user to actively open the app.
3 Key Strategies to Make SwiftUI Views More Reusable
While the declarative nature of SwiftUI makes it possible to quickly put together complex user interfaces, it also makes it easy to create massive view bodies that soon become unmaintainable. In this article, we will see how to modularize your code to make SwiftUI views more reusable.
Formatting Values in SwiftUI Text and TextField
Text view in SwiftUI is probably the most used view by every developer, as presenting content is a fundamental part of making an app. Usually we display String values, and we also read String values in text fields too. But often values must be formatted before shown to users or when inserted into an app. Such values could be, for instance, temperatures, percentages, properly formatted dates, names, and more.
Make a SwiftUI Toolbar Customizable
The post explains how SwiftUI’s customizable toolbar API lets developers create flexible toolbars where users can add, remove, and rearrange items. It covers using toolbar(id:), assigning unique IDs to ToolbarItems, and adding flexible or fixed spacers for better layout control.
SwiftUI: @State under the hood
A SwiftUI View is a value type. There is no heap allocation, no reference counter, no object identity. When SwiftUI needs a new description of your UI, it constructs your struct from scratch, calls body, and discards the instance. The struct is ephemeral by design.
