Closed fabricetiennette closed 1 year ago
Not quite sure what you mean by "backward overlay"?
Do you mean the dimmed background when displaying the alert?
In general the custom alert is designed to look and behave exactly like the native alert, but if needed I could add the ability to customize the background, which would also allow it to be removed entirely.
@divadretlaw Is there a way I can override the background color around the alert content view?
@mickey4u you mean like this?
Then yes
.customAlert("Title", isPresented: $showAlert) {
Text("Content")
} actions: {
Button(role: .cancel) {
} label: {
Text("OK")
}
}
.configureCustomAlert { configuration in
configuration.background = .color(Color.purple.opacity(0.5))
}
You can customize the styling via configureCustomAlert
. If you are missing some customization options you can create an issue or a pull request.
See https://github.com/divadretlaw/CustomAlert/blob/main/Demo/Demo/Alerts/CustomAlerts.swift#L98 for a heavily customized alert example.
@divadretlaw no I tried that, so when you embed a custom view into the customAlert it has the default background around the custom view.
@mickey4u I don't quite follow, please create a separate issue with some example code if you still have some questions
Here are three configurations with the alert having custom colors. Depending on the configuration you see something of the alert background or not
The alert is configured as follows
Default | No title, just custom view | No title, alert padding = 0 |
---|---|---|
Are you thinking of a backward overlay removal option feature in the future ?