Thanks to your help, I have now managed to do it.
@IBAction func system(_ sender: Any) {
let window = UIApplication.shared.keyWindow
window?.overrideUserInterfaceStyle = .unspecified
}
@IBAction func dunkel(_ sender: Any) {
let window = UIApplication.shared.keyWindow
window?.overrideUserInterfaceStyle = .dark
}
@IBAction func hell(_ sender: Any) {
let window = UIApplication.shared.keyWindow
window?.overrideUserInterfaceStyle = .light
}
solved Switch between dark and light mode (Swift) [closed]