INNER CODE UNIT · Swift

initWatchConnectivity

retromp3/retro · ios/Runner/AppDelegate.swift:20

    private func initWatchConnectivity() {
        guard WCSession.isSupported() else { return }
        session = WCSession.default
        session?.delegate = self
        session?.activate()
    }
    
    private func initFlutterChannel() {
        DispatchQueue.main.async {
            guard let controller = self.window?.rootViewController as? FlutterViewController else { return }
            
            let channel = FlutterMethodChannel(name: "co.retromusic.app", binaryMessenger: controller.binaryMessenger)
            channel.setMethodCallHandler { [weak self] call, result in
                let method = call.method
                let args = call.arguments
                
                guard method == "forwardToAppleWatch" else { return }
                guard let watchSession = self?.session, watchSession.isPaired, let messageData = args as? [String: Any] else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…