There is a computed property computedArray and a stored property storedArray in my programme, both of which get values from DataController.shared.updateArray(withCurrentTimestamp: DataController.currentTimestamp)
The value of currentTimestamp changes over time, but when I print out DataController.shared.computedArray and DataController.storedArray, the result of DataController.shared.computedArray changes with currentTimestamp, while DataController.storedArray never changes. what's the reason of it?
struct DataController {
static let shared = DataController()
var computedArray: [TimeInterval] {
get {
DataController.shared.updateArray(withCurrentTimestamp: DataController.currentTimestamp)
}
}
static var storedArray = DataController.shared.updateArray(withCurrentTimestamp: DataController.currentTimestamp)
}