# 18 : Happy Spring Festival!

Published on

Get weekly handpicked updates on Swift and SwiftUI!

Weekly Comment

Apple Vision Pro started shipping to customers a few days ago, with the first batch of deliveries exceeding expectations impressively. Feedback from various quarters indicates that aside from its weight and price, the Apple Vision Pro surpasses its competitors in most aspects of the experience. Numerous users have already showcased videos on social media of using the device in various scenarios such as driving, exercising, walking, and working, hinting at the emergence of a new cyberculture. We look forward to this trend continuing and hope to see breakthrough applications soon that fully leverage the potential of the Apple Vision Pro.

Moreover, last week, Apple also announced the first open-source release of a programming language named Pkl (pronounced as Pickle). Pkl is specifically designed for writing configuration files and is intended to be used as a command-line tool, software library, or build plugin. The developers of Pkl argue that configuration files are best written in a dedicated configuration language, which combines the features of static configuration formats and general-purpose programming languages. Notably, despite being an official Apple release, Pkl is currently implemented in Java and only supports editors like IntelliJ, VSCode, and Neovim. At present, Pkl has provided support libraries for Java, Kotlin, Swift, and Go, meaning iOS developers can now use Pkl language to create configuration files in their Swift projects.

As for why Apple launched this language and the potential scenarios it might be used within Apple’s development ecosystem, it’s left to the readers’ imagination.

With the Spring Festival — China’s traditional festival — approaching, I would like to extend my sincerest wishes to all readers in advance: Happy New Year, wishing you and your family happiness, health, and prosperity in the Year of the Dragon!

Next week, I will be celebrating the Spring Festival with my family, so both the newsletter and the blog will be on a break for a week.

Originals

Exploring SwiftUI Property Wrappers: @FetchRequest, @SectionedFetchRequest, @Query, @Namespace, @Bindable

Fatbobman

In this article, we will explore property wrappers such as @FetchRequest, @SectionedFetchRequest, @Query, @Namespace, and @Bindable. These property wrappers encompass functionalities such as retrieving Core Data and SwiftData within views and creating namespaces in views.

This is the third article in the “Exploring SwiftUI Property Wrappers” series (out of four), where we previously discussed: @State, @Binding, @StateObject, @ObservedObject, @EnvironmentObject, @Environment and @AppStorage, @SceneStorage, @FocusState, @GestureState, @ScaledMetric.

Recent Selections

If you are a developer of Apple Vision Pro, then you must pay attention to these points

ZionOneeSketchK

Apple Vision Pro has officially hit the market, and many developers will soon (if they haven’t already) receive the devices they’ve ordered. For those of you who are or will soon become developers for Apple Vision Pro applications, what are the key points to keep in mind? This article, co-written by three members of XReality Zone, aims to provide developers with a comprehensive guide to designing and developing applications for Apple Vision Pro. The article covers several core topics, including how to debug the device, how to create App Store videos and screenshots according to Apple’s specifications, and how to effectively use various tools and techniques to create high-quality app previews. This guide is designed to help developers fully understand the development details related to Apple Vision Pro, ensuring their applications can pass review smoothly and attract their target users.

If you’ve created a visionOS app with a volume, you probably did it wrong

Drew Olbrich

This article highlights a common mistake developers make when designing visionOS applications, especially when implementing the volume mode. Drew Olbrich points out that the sample code provided by Apple for creating volume windows does not take into account the “Window Zoom” setting in visionOS. If developers fail to properly handle this setting, the application content may be incorrectly cropped. Olbrich emphasizes the importance of mastering how to correctly adapt to the Window Zoom settings to ensure that applications display as expected under different user settings, avoiding poor user experiences due to oversight of this issue.

Mastering the Model Layer: Iron-Clad State Management in Model-Driven Apps

Lucas van Dongen

This article discusses the strategy of adopting state as the core in application development, elucidating through practical examples and code demonstrations how to implement effective state management in complex applications and expand the functionality and scale of applications through robust state management policies. Lucas van Dongen emphasizes that in the iOS development realm, architectures such as Model-View-ViewModel (MVVM), Model-View-Controller (MVC), and the practice of directly connecting the model to the view in SwiftUI have become mainstream. While these patterns provide an easy entry path for beginners, enabling rapid prototyping, developers often struggle to maintain the accuracy and clarity of application state, especially when facing numerous external events (such as push notifications, WebSocket, state restoration, or background tasks) as the application grows in complexity. The author also specifically notes that in certain cases, state should not directly drive the UI—such as with temporary states and navigation states, which should be managed as separate properties within the view model to avoid directly binding them to the shared state, thereby ensuring the clarity and maintainability of the application logic.

Mastering App Intents: Querying Made Easy

Ashli Rankin

This article explores strategies for efficient data retrieval in iOS development, particularly emphasizing how App Intents simplify the sharing of data and logic between an application and its App Intent. Ashli Rankin demonstrates through a simple to-do list application example how to share data between an application’s existing data model and an App Intent, with a focus on how to mark specific tasks in the task list as completed.

Support Swift macros with CocoaPods

Soumya Mahunt

This article, written by Soumya Mahunt, aims to guide developers on how to distribute macros introduced in Swift 5.9 via CocoaPods. Since macros are closely associated with the Swift Package Manager (SwiftPM), they might pose limitations for some use cases. To address this, Mahunt offers a solution by distributing macros through CocoaPods, thus overcoming the constraints related to SwiftPM. The author also believes that distributing macros via CocoaPods has subtle advantages over SwiftPM, including the ability to set lower deployment targets and avoid potential conflicts with swift-syntax versions, providing developers with an effective alternative.

Weekly Swift & SwiftUI insights, delivered every Monday night. Join developers worldwide.
Easy unsubscribe, zero spam guaranteed