Post

Replies

Boosts

Views

Activity

Bug: SwiftUI Metal shader doesn't respect alpha value in Dark Mode
Xcode 15.0.1, iOS 17.0.2 Problem: when drawing a shader in Dark mode, a SwiftUI shader does not use the alpha channel correctly. This behaviour occurs even if the shader sets the alpha value to 0. This occurs in the Xcode Canvas (Preview), the Xcode simulator and on device. This behaviour occurs regardless of whether the original or new color is a Dynamic Color (e.g. .orange) or an absolute color (e.g. a hex value.) Further... if I force-quit the app, set the device to Dark Mode, and relaunch the app, I very briefly see the desired result -- the globe shows on a dark background perhaps for 1 frame -- but then the globe is quickly replaced by a solidly filled rectangle (the globe's frame). // SwiftUI view struct ContentView: View { var body: some View { Image(systemName: "globe") .font(.system(size: 200)) .foregroundStyle(.blue) .colorEffect( ShaderLibrary.replaceColor(.color(Color(hex: "ff8000"))) ) } } // Shader code #include <metal_stdlib> using namespace metal; /// Given an existing color, replace it with a new color, but using the old color's alpha. [[stitchable]] half4 replaceColor(float2 pos, half4 oldColor, half4 newColor) { return half4(newColor.r, newColor.g, newColor.b, oldColor.a); } Question: what am I missing here? My guess is that it has something to do with the alpha premultiplication. But how to fix this? Thank you for any help. Light Mode Dark Mode
4
1
822
Dec ’23
What screen sizes, devices must we support for iOS 13, 14?
I've been trying to get clarification on device support, but what official sources I've found have been ambiguous. If making an app for iOS 13/14 (iPhone only, not supporting iPad OS), in terms of app submission rules: What is the smallest screen size that we need to design for and support? Do we need to support the iPod (7th generation)? Or can we elect not to support iPods? Currently, the smallest compatible iPhone form factor is 4.7". Whereas the iPod is 4". For business, design and usability reasons, it would be much easier to design for a lower limit of 4.7", rather than the (very restrictive) 4" screens. Is that acceptable with regards to the app store rules? Thanks for any help.
2
0
5.5k
Jul ’20
Xcode 10.3 - No Simulators Available
Xcode 10.3 (10G8) (App Store)Mojave 10.14.5 (18F132)Problem: No Simulators appear in the active Scheme popup menu.The Simulators were available and working in Xcode 10.2.1The Download Simulators window informs me that iOS 10.3.1 is the current Simulator and that the latest iOS Simulator available for download is iOS 12.2.If I attempt to perform Add Additional Simulator (e.g. iPhone XR), I get the error:Invalid runtime: com.apple.CoreSimulator.SimRuntime.iOS-12-4I have reinstalled Xcode 10.2.1 alongside Xcode 10.3.When using the newly reinstalled Xcode 10.2.1. the Simulators are are available, and the chosen Simulator (iPhone XR - 12.2) works.$ xcrun simctl list runtimes== Runtimes ==iOS 9.3 (9.3 - 13E233) - com.apple.CoreSimulator.SimRuntime.iOS-9-3iOS 10.3 (10.3.1 - 14E8301) - com.apple.CoreSimulator.SimRuntime.iOS-10-3iOS 12.4 (12.4 - 16G73) - com.apple.CoreSimulator.SimRuntime.iOS-12-4tvOS 12.4 (12.4 - 16M567) - com.apple.CoreSimulator.SimRuntime.tvOS-12-4watchOS 5.3 (5.3 - 16U567) - com.apple.CoreSimulator.SimRuntime.watchOS-5-3Any suggestions are appreciated.
20
0
43k
Jul ’19