-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Fallback bezel size doesn't work on first run #30
Comments
Good catch! The issue lies with I updated your code to be this as a test: @main
struct BezelKit_TestApp: App {
init() { CGFloat.setFallbackDeviceBezel(40.0, ifZero: true) }
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
CGFloat.setFallbackDeviceBezel(40.0, ifZero: true)
let _ = print("@main - identifier: ", ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "")
let _ = print("@main - bezel:", CGFloat.deviceBezel)
}
}
}
}
struct ContentView: View {
@State private var edgeSize: CGFloat = 10
@State private var showErrorAlert: Bool = false
@State private var errorMessage: String = ""
var body: some View {
// ...
}
.onAppear {
// exiting errorCallback
let _ = print("@onAppear - identifier: ", ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "")
let _ = print("@onAppear - bezel:", CGFloat.deviceBezel)
}
} When I run it, the output to the console is in reverse order from what we would assume: @onAppear - identifier: iPhone14,6
@onAppear - bezel: 40.0
@main - identifier: iPhone14,6
@main - bezel: 0.0 That means that I'm not sure if this is intended or an Apple bug - but one way to get around it is to add an @main
struct BezelKit_TestApp: App {
init() { CGFloat.setFallbackDeviceBezel(40.0, ifZero: true) }
var body: some Scene {
WindowGroup {
ContentView()
.onAppear {
let _ = print("@main - identifier: ", ProcessInfo().environment["SIMULATOR_MODEL_IDENTIFIER"] ?? "")
let _ = print("@main - bezel:", CGFloat.deviceBezel)
}
}
}
} This results in the following: @onAppear - identifier: iPhone14,6
@onAppear - bezel: 40.0
@main - identifier: iPhone14,6
@main - bezel: 40.0 Which has solved it for the run. Not sure if that is the best solution or efficient at this point, but it works for now. |
Fixed in #31 |
Describe the bug
When setting a fallback size that's not zero with
ifZero: true
, the fallback size isn't applied when the app loads on iPhone SE / 7. As far as I can tell, it only shows the expected radius after updating it manually.Reproduction steps
When I run the following code on an iPhone SE in simulator and on a physical iPhone 7, the corners show up completely sharp. The corners then update to the correct cornerRadius only after changing
edgeSize
. No errors or warnings are shown.Expected behaviour
View should have rounded corners when app first loads.
Screenshots
Device information
iPhone SE in simulator, physical iPhone 7 running v 15.7.9
The text was updated successfully, but these errors were encountered: