Post

Replies

Boosts

Views

Activity

Reply to "Unexpectedly found nil while unwrapping an Optional value" in URL
At what point does GlobalString().link goes from an empty string to a valid URL before being used. The pattern around the usage of GlobalString is also incorrect. @main struct WallTaker_for_macOSApp: App { @AppStorage("showMenuBarExtra") private var showMenuBarExtra = true @StateObject var globalString = GlobalString() var body: some Scene { WindowGroup { ContentView() .environmentObject(globalString) } } } Then change link from an empty string to a valid URL string to prevent the URL init from returning nil. Also change from url = URL(string: GlobalString().link) to url = URL(string: globalString.link) from .task { await Wallpaper().fetchLink() } to something like .task { let wallpaper = Wallpaper() wallpaper.url = URL(globalString.link) await wallpaper.fetchLink() }
Topic: Programming Languages SubTopic: Swift Tags:
May ’24
Reply to Central American NSTimeZone instances returning CST rather than permanently CDT
This is the world standard Central Daylight Time (CDT) is a North American time zone that is used from the second Sunday in March to the first Sunday in November during Daylight Saving Time (DST). Central Standard Time (CST) is used during the remainder of the year. System developers will eventually adapt since a sudden change will result in repercussions in various financial markets and platforms. File a bug with Apple via the feedback app.
Topic: App & System Services SubTopic: General Tags:
May ’24