Reputation: 41
I want to write an app where I create a database of all the changes made in one setting from UIKit. The flow in SwiftUI:
How should I design my app to be able to do this?
This is my first time creating an iOS app. From my research I think that:
I need to create DataController : ObservableObject
-> to controll the data being loaded and saved to the device.
I need to create AppDelegate: NSObject, UIApplicationDelegate {}
In my @main struct I need to add
@UIApplicationDelegateAdaptor(Appdelegate.self) var appDelegate
I got stuck in the middle because I do not know how to configure my notification center. Where it should be added?
NotificationCenter.default
.addObserver(self,
selector:#selector(mySelector),
name: NSNotification.Name("Name_StatusDidChangeNotification"),
object:nil)
@objc func mySelector(_ notification: Notification) {
//saving DateTime into Storage
}
Upvotes: 2
Views: 227