Created
June 6, 2017 20:22
-
-
Save jensmeder/477cc2dfabf6aef486bbcd93d50aebb6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CoreNFC | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate, NFCNDEFReaderSessionDelegate { | |
var window: UIWindow? | |
var session: NFCNDEFReaderSession? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
self.session = NFCNDEFReaderSession(delegate: self, queue: DispatchQueue.global(qos: .background), invalidateAfterFirstRead: false) | |
self.session?.begin() | |
return true | |
} | |
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { | |
print(error) | |
} | |
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) { | |
print(messages) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment