Creates and initializes a new NFC NDEF reader session.


init(delegate: NFCNDEFReaderSessionDelegate, queue: DispatchQueue?, invalidateAfterFirstRead: Bool)



The NFC NDEF delegate that handles reader session callbacks.


A queue onto which delegate callbacks are dispatched (the session retains the queue). When queue is nil, an internal serial dispatch queue is created for the session.


A Boolean value that indicates whether the session automatically invalidates after the first NDEF tag is successfully read.


When invalidateAfterFirstRead is false, the reader session can read multiple NFC tags. For each successful read, the delegate's readerSession(_:didDetectNDEFs:) method delivers the message. A reader session that can read multiple tags terminates when the session times out or when the session is canceled by the client app (by calling invalidate()) or the user (via the user interface).

When invalidateAfterFirstRead is true, the reader session automatically terminates after the first NFC tag is successfully read. In this scenario, the delegate receives the NFCReaderError.Code.readerSessionInvalidationErrorFirstNDEFTagRead status in readerSession(_:didInvalidateWithError:).

See Also

Creating a Session

protocol NFCNDEFReaderSessionDelegate

A protocol that an object implements to serve as an NDEF reader session delegate.