Post

Replies

Boosts

Views

Activity

Reply to Widget showsWidgetContainerBackground fallback
The below provides a quick and simple solution: private struct _ShowsWidgetContainerBackground: EnvironmentKey { static let defaultValue: Bool = true } extension EnvironmentValues { var showsWidgetContainerBackgroundWithFallback: Bool { get { if #available(iOSApplicationExtension 17.0, *) { self.showsWidgetContainerBackground } else { self[_ShowsWidgetContainerBackground.self] } } set {} } } You can use the new environment key showsWidgetContainerBackgroundWithFallback in place of showsWidgetContainerBackground.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’23
Reply to High battery drain using Xcode 13
I've noticed that even after quitting Xcode 13 and simulators, the battery drain is still there (M1 Max 2021). I'm not just closing windows - I'm quitting the applications completely. It's most noticeable while my MacBook sleeps: the battery consistently loses 2% or so per hour. Not a big deal for a couple of hours, but if I leave my MacBook sleeping for 2 or 3 days, I come back to find the battery almost dead. This is very consistently reproducible. If I open Activity Monitor, the '12 hr battery drain' records show that Xcode was indeed the main culprit, despite the fact it was no longer running. Also reproducible: if I cold start my MacBook, and don't open Xcode, sleeping will drain almost no battery, even over longer timespans. Although it might seem odd that the battery drain persists after quitting, it's pretty clearly Xcode that is at fault.
Nov ’21
Reply to Widget showsWidgetContainerBackground fallback
The below provides a quick and simple solution: private struct _ShowsWidgetContainerBackground: EnvironmentKey { static let defaultValue: Bool = true } extension EnvironmentValues { var showsWidgetContainerBackgroundWithFallback: Bool { get { if #available(iOSApplicationExtension 17.0, *) { self.showsWidgetContainerBackground } else { self[_ShowsWidgetContainerBackground.self] } } set {} } } You can use the new environment key showsWidgetContainerBackgroundWithFallback in place of showsWidgetContainerBackground.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’23
Reply to High battery drain using Xcode 13
I've noticed that even after quitting Xcode 13 and simulators, the battery drain is still there (M1 Max 2021). I'm not just closing windows - I'm quitting the applications completely. It's most noticeable while my MacBook sleeps: the battery consistently loses 2% or so per hour. Not a big deal for a couple of hours, but if I leave my MacBook sleeping for 2 or 3 days, I come back to find the battery almost dead. This is very consistently reproducible. If I open Activity Monitor, the '12 hr battery drain' records show that Xcode was indeed the main culprit, despite the fact it was no longer running. Also reproducible: if I cold start my MacBook, and don't open Xcode, sleeping will drain almost no battery, even over longer timespans. Although it might seem odd that the battery drain persists after quitting, it's pretty clearly Xcode that is at fault.
Replies
Boosts
Views
Activity
Nov ’21