Swift Package Index


Support library for NFC NDEF Records


  • The latest stable release is 0.7.1. Released 6 months ago.
  • The last commit to master was 6 months ago.

Swift Version Compatibility

  • 0.7.1 and master
    5.3
    5.2
    5.1
    5.0
    4.2
Full build results

Platform Compatibility

  • 0.7.1 and master
    iOS
    macOS(Intel)
    macOS(ARM)
    Linux
    tvOS
    watchOS
Full build results

NFCSupport

Xcode Swift platforms Travis CI

This is support library for handling NFC NDEF Records.

Environment

  • iOS11
  • Swift 5.2

Supported record type

  • Text Record
  • URI Record
  • Smart Poster Record

Usage

guard let result = try? NFCNDEFWellknown.parse(type: record.type, payload: record.payload) else {
    print("can not parse record")
    return
}

switch result {
case let .text(record):
    print("text: \(record.text)")
case let .uri(record):
    print("uri: \(record.uri?.absoluteString ?? "")")
case let .smartPoster(record):
    print("title: \(record.titleRecords.first?.text ?? "") uri: \(record.uri?.absoluteString ?? "")")
case let .unsupported(type):
    print("unsupported record type (\(type))")
}

Installation

Carthage

To install it, simply add the following line to your Cartfile:

github "yshrkt/NFCSupport"

CocoaPods

To install it, simply add the following line to your Podfile:

pod "NFCSupport"

Licence

NFCSupport is released under the MIT license. See LICENSE for details.

Author

yshrkt