-
Meet Watch Face Sharing
Show off your watchOS app's complications and create a watch face worth sharing. Learn how to share watch faces inside your watchOS and iOS apps or host them on the web for anyone to find and download. We'll also explore best practices for using watch face preview images, and show you how to create a smooth installation experience.
Recursos
Vídeos relacionados
WWDC20
-
Buscar neste vídeo...
-
-
7:20 - Detect Paired Watch
var isPaired: Bool { if (WCSession.isSupported()) { let session = WCSession.default session.delegate = self session.activate() return session.isPaired } else { return false } } -
9:01 - Add Face Wrapper
private func addFaceWrapper(withName: String) { if let watchfaceURL = Bundle.main.url(forResource: withName, withExtension: "watchface") { CLKWatchFaceLibrary().addWatchFace(at: watchfaceURL, completionHandler: { (error: Error?) in if let nsError = error as NSError?, nsError.code == CLKWatchFaceLibrary.ErrorCode.faceNotAvailable.rawValue { print(nsError) } isLoading = false }) } } -
11:04 - Add Face Wrapper with Fallback Face
private func addFaceWrapper(withName: String, fallbackName: String?) { if let watchfaceURL = Bundle.main.url(forResource: withName, withExtension: "watchface") { CLKWatchFaceLibrary().addWatchFace(at: watchfaceURL, completionHandler: { (error: Error?) in if let nsError = error as NSError?, nsError.code == CLKWatchFaceLibrary.ErrorCode.faceNotAvailable.rawValue { if let name = fallbackName { // We failed, trying with fallbackName. addFaceWrapper(withName: name, fallbackName: nil) } } isLoading = false }) } }
-