Post

Replies

Boosts

Views

Activity

Reply to Using SwiftUI, I want to determine 12 hour vs 24 hour from system settings
ADDITIONAL INFORMATIONI’m using Xcode version 11.3.1 and Catalina version 10.15.1. These are not the latest versions but updating Xcode requires the latest version of Catalina and when I try to update Catalina it reports that my version is up to date. This is a separate issue that I have reported but no resolution at this time.Notice the comments for the following code: let date = Date(). // always returns time in 12 hour format let calendar = Calendar.autoupdatingCurrent let hour = calendar.component(.hour, from: date). // always returns time in 24 hour formatIf I can read the current system settings for clock, I can adjust the hour to match the current system settings for clock.I have read that the following code can be used to determine the clock setting.let dateFormat = DateFormatter.dateFormat (fromTemplate: "j",options:0, locale: Locale.current)However, dateFormat is always set to “j” regardless of the system settings for clock.If anyone knows of a property that can be accessed for 12/24 hour in system setting I would appreciate knowing it.Thanks
Apr ’20