- NFCTagReaderSession
- NFCFeliCaTag
- NFCMiFareTag
- NFCISO7816Tag
- NFCISO15693Tag
- NFCNDEFReaderSession
- NFCVASReaderSession
- iOS 11.0+
- Xcode 9.0+
- Swift 5.0+
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)
You can use CocoaPods to install RxCoreNFC
by adding it to your Podfile
:
pod 'RxCoreNFC'
$ pod install
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
File > Swift Package > Add Package Dependency... > Enter package repository URL
https://github.com/Karibash/RxCoreNFC
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
Copyright © 2020 @Karibash.
This project is MIT
licensed.