Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
contentPostList.repliessolved.tooltip
Replied In
@AppStorage with Date in SwiftUI
I used a setter and a getter. I got the idea from Nick Roosevelt on this post on forums.swift.org. (Thanks Nick!)
I realise it's not an extension on Date, but it's quick & simple and easy to understand, and it's working well for me.
@AppStorage("storedStartTime") var storedStartTime = Date.now.timeIntervalSinceReferenceDate
var startTime: Date {
set {storedStartTime = newValue.timeIntervalSinceReferenceDate}
get {return Date(timeIntervalSinceReferenceDate: storedStartTime)}
}