swiftwatchkitapple-watchwatchos-6waterlock

EnableWaterLock on Apple Watch deprecated are there any alternatives to lock the screen of the watch?


I just saw that WKExtension.shared.EnableWaterLock is now deprecated. I used this method in my workout apps to prevent accidentally tapping the screen and ending the workout etc. Has it been replaced with any other method of locking the screen?


Solution

  • That method wasn't removed from WatchKit, it was just moved from WKExtension to WKInterfaceDevice in watchOS 6.1. See WKInterfaceDevice.enableWaterLock().

    You can call it using WKInterfaceDevice.current().enableWaterLock().