-
Notifications
You must be signed in to change notification settings - Fork 34
NDEFPayload
public struct NDEFPayload
os(iOS) && !targetEnvironment(macCatalyst)
-
Creates a payload record with the specified format, type, identifier, and payload data.
@available(iOS 13.0, *) public init(format: TypeNameFormat, type: Data, identifier: Data, payload: Data)
This initializer uses the maximum payload chunk size defined by the NFC NDEF specification, which is 2^32-1 octets. If the payload size is bigger than the maximum size, the initializer splits the record into multiple record chunks.
- format: A NFC type name format value.
- type: A data object describing the type of payload. If the data is empty, the method excludes this field from the payload record.
- identifier: A URI reference that identifies the payload. If the data is empty, the method excludes this field from the payload record.
- payload: A data object containing the payload data. If the data is empty, the method excludes this field from the payload record.
os(iOS) && !targetEnvironment(macCatalyst)
-
Creates a payload record with the specified format, type, identifier, payload data, and data chunk size.
@available(iOS 13.0, *) public init(format: TypeNameFormat, type: Data, identifier: Data, payload: Data, chunkSize: Int)
- format: A NFC type name format value.
- type: A data object describing the type of payload. If the data is empty, the method excludes this field from the payload record.
- identifier: A URI reference that identifies the payload. If the data is empty, the method excludes this field from the payload record.
- payload: A data object containing the payload data. If the data is empty, the method excludes this field from the payload record.
- chunkSize: The maximum size of a payload chunk. A value of zero indicates that the payload fits in a single record, that is, no chunking of the payload.
os(iOS) && !targetEnvironment(macCatalyst)
-
The Type Name Format field of the payload, as defined by the NDEF specification.
@available(iOS 11.0, *) public var typeNameFormat: TypeNameFormat
os(iOS) && !targetEnvironment(macCatalyst)
-
The type of the payload, as defined by the NDEF specification.
@available(iOS 11.0, *) public var type: Data
os(iOS) && !targetEnvironment(macCatalyst)
-
The identifier of the payload, as defined by the NDEF specification.
@available(iOS 11.0, *) public var identifier: Data
os(iOS) && !targetEnvironment(macCatalyst)
-
The payload, as defined by the NDEF specification.
@available(iOS 11.0, *) public var payload: Data
os(iOS) && !targetEnvironment(macCatalyst)
-
Creates a payload record with a URI specified as a URL.
@available(iOS 13.0, *) public static func wellKnownTypeURIPayload(url: URL) -> Self?
- url: A URL object.
An NDEF payload record.
os(iOS) && !targetEnvironment(macCatalyst)
-
Creates a payload record with a URI specified as a string.
@available(iOS 13.0, *) public static func wellKnownTypeURIPayload(string uri: String) -> Self?
Use this method to create NDEF URI payload records that you can't create using a URL object, such as a URI containing special characters not represented by 7-bit ASCII encoding such as ä and ö.
- uri: A URL string.
An NDEF payload record.
os(iOS) && !targetEnvironment(macCatalyst)
-
Creates a payload record with text.
@available(iOS 13.0, *) public static func wellKnownTypeTextPayload(string text: String, locale: Locale) -> Self?
- text: Text to include in the payload.
- locale: A locale object. This method saves the IANA language code, specified by the locale, to the payload.
An NDEF payload record.
os(iOS) && !targetEnvironment(macCatalyst)
-
Returns the text and locale of a valid Well Known Type Text payload.
@available(iOS 13.0, *) public func wellKnownTypeTextPayload() -> (String?, Locale?)
A tuple containing a string and locale from a Well Known Type Text payload. The string and locale can be
nil
.
os(iOS) && !targetEnvironment(macCatalyst)
-
Returns the URL of a valid Well Known Type URI payload.
@available(iOS 13.0, *) public func wellKnownTypeURIPayload() -> URL?
A URL when the payload contains a Well Know Type URI; otherwise,
nil
.
Generated at 2021-10-28T15:36:42+0000 using swift-doc 1.0.0-rc.1.