肘子的 Swift 记事本

Data Flow and State Management

Photo by Mae Mu on Unsplash

As a reactive framework, SwiftUI offers a plethora of property wrappers that can serve as the Source of Truth, each with its unique purpose and characteristics. Simultaneously, effectively utilizing the various tools provided by SwiftUI to manage data flow presents a significant challenge for every developer.

Overview of Property Wrappers

Mastering Property Wrappers

  • SwiftUI’s StateObject and ObservedObject: The Key Differences

    This article will introduce the similarities, differences, principles, and precautions between StateObject and ObservedObject.

  • SwiftUI 2.0 —— Research on @StateObject

    WWDC 20 just concluded, and in the past week, Apple has brought huge surprises to developers. Due to the plethora of new features, it takes some time to digest them. I first chose the content I am most interested in for some simple research and discussion. This article first briefly discusses the new property wrapper @StateObject provided by SwiftUI.

  • @State Research in SwiftUI

    This article aims to explore and analyze the implementation and operational characteristics of @State in SwiftUI. It concludes with an idea and example for extending the functionality of @State. Readers should have a basic understanding of reactive programming in SwiftUI.

  • ObservableObject Research - Expressing Love is Not Easy

    This article mainly explores in SwiftUI, using a Single Source of Truth development pattern, whether ObservableObject is the best choice. It examines if it's possible to try new approaches without significantly altering the existing design philosophy to improve response efficiency. Finally, a method is provided that still uses the single source of truth design concept but completely abandons the use of ObservableObject.

  • Mastering @AppStorage in SwiftUI

    This article explores how to use @AppStorage in a graceful, efficient, and secure manner within SwiftUI, addressing the current pain points encountered with @AppStorage usage, all without resorting to third-party libraries.

  • Going Beyond @Published:Empowering Custom Property Wrappers

    This article explains how to make a property wrapper notify the class that wraps it of any changes, similar to Published and compliant with the ObservedObject protocol. - SwiftUI - Swift

Architecture

Fatbobman(东坡肘子)

I'm passionate about life and sharing knowledge. My blog focuses on Swift, SwiftUI, Core Data, and Swift Data. Follow my social media for the latest updates.

You can support me in the following ways