Skip to content

connect(to_resultHandler_)

treastrain edited this page Oct 16, 2021 · 2 revisions

connect(to:resultHandler:)

canImport(CoreNFC)

Connects the reader session to a tag and activates that tag.

@available(iOS 13.0, *)
    open func connect(to tag: NFCNDEFTag, resultHandler: @escaping ((Result<Void, NFCReaderError>)) -> Void) 

A tag stays connected until your app connects to a different tag or restarts polling. Connecting to a tag that is already connected has no effect.

Parameters

  • tag: A tag to which the reader session should attempt to connect.
  • resultHandler: A handler that the reader session invokes after the operation completes. The handler receives a Result with the cases:
  • success: A Void.
  • failure: An NFCReaderError object indicating that a communication issue with the tag occurred.

connect(to:resultHandler:)

canImport(CoreNFC)

Connects the reader session to a tag and activates that tag.

@available(iOS 13.0, *)
    open func connect(to tag: NFCTag, resultHandler: @escaping ((Result<Void, NFCReaderError>)) -> Void) 

A tag stays connected until your app connects to a different tag or restarts polling. Connecting to a tag that is already connected has no effect.

Parameters

  • tag: A tag to which the reader session should attempt to connect.
  • resultHandler: A handler that the reader session invokes after the operation completes. The handler receives a Result with the cases:
  • success: A Void.
  • failure: An NFCReaderError object indicating that a communication issue with the tag occurred.
Clone this wiki locally