Обновлено с быстрым 4:
func switchChanged(sender: UISwitch!) {
print("Switch value is \(sender.isOn)")
if(sender.isOn){
print("on")
UIApplication.shared.registerForRemoteNotifications()
}
else{
print("Off")
UIApplication.shared.unregisterForRemoteNotifications()
}
}