Post

Replies

Boosts

Views

Activity

How to set @Environment(\.colorScheme) back to system/automatic?
I'm trying to add a view in my app settings page where the users can choose to force dark mode, light mode or keep the system behavior. If I add .environment(\.colorScheme) to the ContentView it works fine in case I force one of the two themes, but since the available options are only .light or .dark how do I get back to .automatic? I also tried using a conditional modifier for the color scheme, which works, but the problem is that it ends up reloading the all app and it causes the app to jump form settings to the home screen.
1
0
537
Oct ’20
How to use .appStoreOverlay while keeping support for macCatalyst?
I'm using this modifier for my AppClip .appStoreOverlay(isPresented: $showAppStoreOverlay) { 		SKOverlay.AppClipConfiguration(position: .bottomRaised) } When I enable Mac Catalyst support, I get a compile error on SKOverlay with ('SKOverlay' is unavailable in Mac Catalyst) and on .appStoreOverlay with (Value of type 'some View' has no member 'appStoreOverlay') I tried fixing it by wrapping my ContentView with #if targetEnvironment(macCatalyst).. something like: #if targetEnvironment(macCatalyst) ContentView() #else ContentView() 		 .appStoreOverlay(isPresented: $showAppStoreOverlay) { 						SKOverlay.AppClipConfiguration(position: .bottomRaised) 				} #endif This gets rid of the SKOverlay error but I still the compile error for .appStoreOverlay https://developer.apple.com/forums/thread/656574 I found this answer from an Apple engineer but for me the case is the opposite, it compiles fine on the simulator but it doesn't on the real device which I need if I want to archive the app
1
0
632
Oct ’20
NSAccentColorName in bundle is invalid
I'm trying to distribute an app with a watchOS independent app target but it keeps failing with the error: Invalid Info.plist key. The key 'NSAccentColorName' in bundle My/WatchOS/App.app is invalid. I can't see any key with that name and the only way I found to fix it is to remove the accentColor from the Asset folder but doing that I lose the color that I want to use in the watch app
2
0
1.3k
Aug ’20
LazyVGrid, List, LazyStacks are not realising cells from memory?
I'm playing around with the new photo picker in SwiftUI 2 and I made a simple app to show the imported images in a LazyVGrid but when scrolling down, if I imported around 150 images the app finish all the memory and it crashes (Terminated due to memory issue). I tried the same with a LazyVStack and List but they have the same problem, I was expecting lazy items to release all the cells that goes off screen from the memory but it doesn't look like it's working. Is this a bug or am I doing something wrong? Here's my code: PhotoPickerView - https://developer.apple.com/forums/content/attachment/1464aa89-c2b0-4df2-808e-c0feb0536fe3 ContentView - https://developer.apple.com/forums/content/attachment/e2b040f7-f2dc-4eec-8c45-165b770301bd
1
0
1.5k
Jul ’20