openSettings(for:)
Opens the Settings app to a specific section of Accessibility settings.
Declaration
static func openSettings(for feature: AccessibilitySettings.Feature) async throwsDiscussion
Some app behaviors depend on a person turning on a specific Accessibility setting on their device. You can use this method to open the Settings app to a specific Accessibility setting to help people turn it on more quickly, as shown in the following code example.
ContentView()
.alert(
"Use Personal Voice",
isPresented: $showAlert
) {
Button("Open Accessibility Settings") {
Task {
do {
try await AccessibilitySettings.openSettings(for: .personalVoiceAllowAppsToRequestToUse)
} catch {
print("Error: \(error)")
}
}
}
Button("Cancel", role: .cancel) { }
} message: {
Text("To use this feature, turn on the Personal Voice > Allow Apps to Request to Use setting.")
}