Skip to content

Karibash/RxCoreNFC

Repository files navigation

RxCoreNFC

Swift Release Build CocoaPods Carthage SwiftPM Platform License

Github Twitter

🔧 Features

  • NFCTagReaderSession
    • NFCFeliCaTag
    • NFCMiFareTag
    • NFCISO7816Tag
    • NFCISO15693Tag
  • NFCNDEFReaderSession
  • NFCVASReaderSession

✔️ Requirements

  • iOS 11.0+
  • Xcode 9.0+
  • Swift 5.0+

👏 Getting Started

The basic usage is as follows:

let sessions = NFCTagReaderSession.rx.open(pollingOption: [.iso18092])
let tags = sessions.begin().tags().felicaTags()
let connectedTags = Observable.combineLatest(tags, sessions)
    .flatMap { tag, session in session.connect(tag) }
    .share()

let invalidates = connectedTags
    .requestService(nodeCodeList: SERVICE_CODE_LIST)
    .withLatestFrom(connectedTags)
    .readWithoutEncryption(serviceCodeList: SERVICE_CODE_LIST, blockList: BLOCK_LIST })
    .do(onNext: { result in
        // Do something
    })
    .withLatestFrom(sessions)
    .invalidate()
    .first()

button.rx.tap
    .flatMapFirst { invalidates }
    .subscribe()
    .disposed(by: disposeBag)

🚀 Installation

CocoaPods

You can use CocoaPods to install RxCoreNFC by adding it to your Podfile:

pod 'RxCoreNFC'
$ pod install

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/RxCoreNFC.framework to an iOS project.

github "Karibash/RxCoreNFC"
$ carthage update

Swift Package Manager

File > Swift Package > Add Package Dependency... > Enter package repository URL

https://github.com/Karibash/RxCoreNFC

🤝 Contributing

Contributions, issues and feature requests are welcome.

Feel free to check issues page if you want to contribute.

📝 License

Copyright © 2020 @Karibash.

This project is MIT licensed.