SwiftUI Weekly - Issue #189
The curated collection of links about SwiftUI. Delivered every Monday.
Reading
Do NOT init State externally in SwiftUI
SwiftUI only initializes a state object the first time you call its initializer in a given view. This ensures that the object provides stable storage even as the view’s inputs change. However, if you explicitly initialize the state object, it might result in unexpected behavior or unwanted side effects.
Scenes types in a SwiftUI Mac app
Creating versatile and efficient macOS applications with SwiftUI involves understanding how to use various scene types. Scenes in SwiftUI manage and display their contents through windows, with different scene types offering distinct behaviors and capabilities. In this post, we'll explore the different scene types available in SwiftUI for macOS, including WindowGroup
, DocumentGroup
, Settings
, Window
, and MenuBarExtra
.
How to create custom @Environment values in SwiftUI
Learn how to share data between SwiftUI views without passing the data explicitly.
Adding a Bottom Sheet or Partial Modal in SwiftUI
The sheet modifier in SwiftUI is a powerful tool. Did you know that you are able to easily control the height of the sheet? Let’s learn together how to build one in SwiftUI.
AsyncImage in SwiftUI: Loading Images from URLs
AsyncImage
is a convenient SwiftUI view that loads remote images using a URL. It’s especially useful in apps that interact with REST APIs since images are usually referenced using URLs in JSON data.
Bad practice: not using a ButtonStyle
The post about why to use ButtonStyle instead of styling your buttons inline.