是的,Apple Watch 上的时钟与配对的 iPhone 同步。可以使用 WatchKit 框架中的方法 WKInterfaceDevice.current().isPaired
来判断 Apple Watch 是否已经与 iPhone 配对成功。如果已经配对成功,那么 Apple Watch 上的时钟就会同步显示 iPhone 上的时间。
示例代码如下:
if WKInterfaceDevice.current().isPaired {
// 获取当前时间,显示在 Apple Watch 上
let currentTime = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "hh:mm:ss a"
let timeString = dateFormatter.string(from: currentTime)
myLabel.setText(timeString)
}