INNER CODE UNIT · Swift

handle

dotintent/flutter-nfc-reader · ios/Classes/SwiftFlutterNfcReaderPlugin.swift:30

    public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
        switch(call.method) {
        case "NfcRead":
            let map = call.arguments as? Dictionary<String, String>
            instruction = map?["instruction"] ?? ""
            readResult = result
            print("read")
            activateNFC(instruction)
        case "NfcStop":
            resulter = result
            disableNFC()
        case "NfcWrite":
            var alertController = UIAlertController(title: nil, message: "IOS does not support NFC tag writing", preferredStyle: .alert)
            alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
            UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true)
        case "NfcAvailable":
            var nfcAvailable = NFCNDEFReaderSession.readingAvailable
            result(nfcAvailable ? "available" : "not_supported")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…