Код: Выделить всё
import SwiftUI
import CallKit
struct ContentView: View {
var body: some View {
VStack {
Button(action: openCallerIDSettings) {
Text("Open Caller ID Settings")
.padding()
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
}
}
}
private func openCallerIDSettings() {
CXCallDirectoryManager.sharedInstance.openSettings { err in
print(";;;",err as Any)
}
}
}
Код: Выделить всё
private func openCallerIDSettings() {
if let url = URL(string: "App-prefs:Phone&path=CLASSIFICATION_AND_REPORTING") {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... my-app-ios