# 19 : Beyond Code: Embrace the Shift in Mindset

Published on

Explore weekly Swift highlights with developers worldwide

Weekly Comment

After several months of studying SwiftData, I only recently adopted it in my project. However, I found that coding efficiency has decreased compared to using Core Data. This is not because SwiftData is difficult to use; in fact, even though SwiftData is developed based on Core Data, to use and understand it correctly, I had to abandon many of the Core Data experiences I previously mastered and try to adopt programming logic more aligned with the design philosophy of SwiftData, leading me to start over several times.

I’ve noticed that many developers transitioning from Core Data to SwiftData often only take a few days or even less time. This approach can lead to a problem: simply treating SwiftData as a Swift-language version of Core Data and merely converting Core Data code into SwiftData code. This situation does not only occur with the application of SwiftData; in the use of the Observation framework, developers are merely converting code based on ObservableObject into a new pattern. This method severely weakens the opportunity for structural and conceptual changes brought about by the framework transition, which is a significant regret.

It has been five years since SwiftUI was released, and although the development speed is not fast, Apple has gradually provided developers with a more comprehensive modern programming framework. Currently, the main challenge developers face is a lack of deep understanding and practical experience with this framework. In the process of framework transition, developers should not only be limited to direct code conversion but also need to undergo a shift in thinking and philosophy to truly unlock and utilize the full potential of the new framework.


Exploring Property Wrappers in SwiftUI: @UIApplicationDelegateAdaptor, @AccessibilityFocusState, @FocusedObject, @FocusedValue, and @FocusedBinding


In this article, we will explore property wrappers such as @UIApplicationDelegateAdaptor, @AccessibilityFocusState, @FocusedObject, @FocusedValue, and @FocusedBinding. These property wrappers cover various functionalities including integration across different framework lifecycles, assistive focus, and management of focused value observations.

Swift property wrappers were born the same year as SwiftUI. SwiftUI takes full advantage of this feature, offering developers a series of property wrappers that greatly simplify the development process. In this series of four articles, we have thoroughly sorted through all the property wrappers provided by SwiftUI up to iOS 17, aiming to help developers use SwiftUI more efficiently and conveniently. We hope this content will provide valuable guidance and assistance to everyone using SwiftUI.

Recent Selections

The Swift Method Dispatch Deep Dive

Jacob Bartlett

This article delves into the method dispatch mechanism in the Swift language, aiming to elucidate the mechanism of Swift’s function calls and their specific impact on code performance. The author, Jacob Bartlett, employs both detailed and comprehensible approaches to analyze the basic concept of method dispatch and how various types of method dispatch (including static dispatch, table dispatch, and message dispatch) affect code performance. The article further discusses adopting certain strategies, such as using the final keyword, privatizing methods, and optimizing the entire module, to reduce the frequency of dynamic dispatch, thereby effectively enhancing the execution efficiency of Swift code.

Discovering Swift Algorithms package

Majid Jabrayilov

Maintained officially by Apple, Swift Algorithms is an open-source library designed to bring a series of efficient, powerful, and practical algorithm extensions to the Swift language. By enriching the collection of algorithms in the Swift standard library, the library greatly facilitates developers in data processing and computation. In this article, Majid Jabrayilov utilizes his extensive practical experience to show us how to leverage various functionalities provided by the Swift Algorithms library, such as binary search, data chunking, filtering, sampling, and element combination, to effectively enhance the efficiency and performance of project development.

Encapsulate and Generalize in Swift

Scott Smith

Frequent incorporation of third-party libraries in projects leads developers to extensively use import statements in their code. In his article, Scott Smith proposes a strategy to alleviate the burden of third-party dependencies in Swift projects: ensuring that each third-party library is imported only once throughout the entire project and avoiding the direct use of dependency names in variables, class names, or any other identifiers. He emphasizes that by encapsulating and generalizing references to third-party libraries, it is possible to prevent the code from being too tightly coupled with specific libraries, a tight coupling that introduces unnecessary complexity and additional work when switching libraries or adjusting functionalities.

The SwiftUI Field Guide

Chris Eidhof

SwiftUI offers a set of rich and powerful layout tools. However, for beginners, it’s often difficult to quickly grasp the specific functions and application effects of various layout containers and their parameters merely by reading the documentation. To address this challenge, Chris Eidhof launched “The SwiftUI Field Guide” website. This site uses interactive demonstrations to explain in detail the workings of the SwiftUI layout system, aiming to help developers intuitively master the use of layout tools.

It’s important to note that the SwiftUI layout effects displayed on the website are implemented using web technologies, so their behavior may have slight differences from SwiftUI’s actual performance. Despite this, these differences do not hinder developers’ understanding and learning of the basic functions of layout containers.

A week on with a VisionPro

Joseph Heck

In this article, Joseph Heck documents his initial experience with using the Apple Vision Pro, including his thoughts and feelings, with the intention of reflecting on the changes the product undergoes after several iterations and updates. Although he encountered some challenges and shortcomings during use, Heck maintains a positive attitude towards the development and application potential showcased by the Apple Vision Pro, especially in areas such as information visualization and software debugging. He is filled with anticipation for future innovations and explorations using the Apple Vision Pro, demonstrating a developer’s enthusiasm for exploring the endless possibilities of new technology.

Get weekly handpicked updates on Swift and SwiftUI!

Buy me a if you found this article helpful