SwiftUI:如何每天刷新Apple Watch并发症

时间:2020-04-07 22:04:12

标签: xcode swiftui apple-watch

我做了一个Watch并发症,它可以正常工作,但是随着我设置结束日期,它不会每天更新,这是ComplicationController中的代码:

    func getSupportedTimeTravelDirections(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimeTravelDirections) -> Void) {
    handler([.forward, .backward])
}

func getTimelineStartDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
    handler(Date())
}

func getTimelineEndDate(for complication: CLKComplication, withHandler handler: @escaping (Date?) -> Void) {
    handler(Date().addingTimeInterval(60*60*24))
}

0 个答案:

没有答案