-
Notifications
You must be signed in to change notification settings - Fork 34
NDEFTagProtocol
public protocol NDEFTagProtocol
A Boolean value that determines whether the NDEF tag is available in the current reader session.
var isAvailable: Bool
Asks the reader session for the NDEF support status of the tag.
@available(iOS 13.0, watchOS 99.0, tvOS 99.0, macOS 99.0, macCatalyst 99.0, *)
func queryNDEFStatus(resultHandler: @escaping (Result<(NDEFStatus, Int), Error>) -> Void)
- resultHandler: Returns
(NDEFStatus, Int)
or anNSError
object if the query fails.status
is theNDEFStatus
of the tag.capacity
indicates the maximum NDEF message size, in bytes, that you can store on the tag.
Retrieves an NDEF message from the tag.
@available(iOS 13.0, watchOS 99.0, tvOS 99.0, macOS 99.0, macCatalyst 99.0, *)
func readNDEF(resultHandler: @escaping (Result<NDEFMessage?, Error>) -> Void)
- resultHandler: The handler invoked by the reader session that provides the NDEF message. The handler has the following parameters:
message
is anNDEFMessage
object, or nil if an error occurs while retrieving the message. AnNSError
object if the query fails.
Saves an NDEF message to a writable tag.
@available(iOS 13.0, watchOS 99.0, tvOS 99.0, macOS 99.0, macCatalyst 99.0, *)
func writeNDEF(_ ndefMessage: NDEFMessage, resultHandler: @escaping (Result<Void, Error>) -> Void)
To determine whether the tag is writable, call queryNDEFStatus(completionHandler:)
and check that the status is NDEFStatus.readWrite
.
- ndefMessage: The NDEF message to write to the tag.
- resultHandler: The handler invoked by the reader session after completing the write request. The session calls completionHandler on the dispatch queue provided when creating the
NDEFReaderSession
. AnNSError
object if the write request fails. A value ofVoid
indicates that the write was successful.
Changes the NDEF tag status to read-only, preventing future write operations.
@available(iOS 13.0, watchOS 99.0, tvOS 99.0, macOS 99.0, macCatalyst 99.0, *)
func writeLock(resultHandler: @escaping (Result<Void, Error>) -> Void)
Calling this method updates the write access condition byte in the NDEF File Control of the tag's file system, thus locking the tag. This is a permanent action that you cannot undo. After locking the tag, you can no longer write data to it.
- resultHandler: The handler invoked by the reader session after completing the lock request. The session calls completionHandler on the dispatch queue provided when creating the
NFCNDEFReaderSession
. AnNSError
object if the write request fails. A value ofVoid
indicates that the session locked the tag and future write requests aren't possible.
Generated at 2021-10-28T15:36:42+0000 using swift-doc 1.0.0-rc.1.