Hi there, 

I am curious about how an autoupdating type property like `NSTimeZone.local` could be implemented, given that it is a value (the type is TimeZone). The requirement essentially is that if the default timezone is changed, the change should reflect in all copies of this value.

import Foundation


let local = NSTimeZone.local

let local1 = local

print(local)  //prints the default TimeZone

print(local1) //prints the default TimeZone


let t = TimeZone(identifier: "America/Chicago")!

NSTimeZone.default = t


print(local)    //prints "America/Chicago (autoupdatingCurrent)

print(local1)   //prints "America/Chicago (autoupdatingCurrent)



What makes it complicated is that TimeZone is a value type. I hope I am not missing something fundamental here!

Any ideas or information will be highly appreciated. Thanks!

Pushkar N Kulkarni,
IBM Runtimes

Simplicity is prerequisite for reliability - Edsger W. Dijkstra


_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

Reply via email to