Since updating to XCode 16, the following error is thrown in the Defaults package: "Accessing StateObject's object without being installed on a View. This will create a new instance each time."
I'm using the package in one view only:
public let extensionDefaults = UserDefaults(suiteName: "...")!
extension Defaults.Keys {
public static let isBypass = Key<Bool>("isBypass", default: false, suite: extensionDefaults)
public static let deviceID = Key<String>("deviceID", default: noneDeviceID, suite: extensionDefaults)
}
struct TabSettingsView: View {
...
@Default(.deviceID) var deviceID: String
@Default(.isBypass) var isBypass: Bool
...
}
Am I using it wrong? Before, in XCode 15, this error did not show up. And I'm using the latest main branch commit.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too