I am learning SwiftUI and Combine and have a Combine question.
As a first app, I've built one similar to the one in the Intro to SwiftUI session.
The data model is an ObservableObject that has a @Published property of an array of Person structs. The Person structs all conform to Codable.
It is not a document-based app, so there will be one file containing the app data that will live in Application Support (a 'shoebox' app).
I have the SwiftUI stuff working just fine. But I really am stuck as the best way to use Combine to read in the data on app launch (since I know it can automatically decode data, etc.) and then when the array of Person structs changes, or one of the Person structs is edited in the app, how does the ObservableObject find out a change has occurred so it can write the changes back to the file?
Any help or suggestions as to what would be the best approach for this would be greatly appreciated.