Giter Club home page Giter Club logo

swiftnfc's Introduction

SwiftNFC ๐Ÿ“ฑ๐Ÿท๏ธ - Powerful Read+Write within few lines of Coding

Accelerated by Apple SwiftUI & Backed with CoreNFC

Aims

Provide a super-easy way for Apple Developers to Read and Write NFC Tags on SwiftUI.

Version

GitHub release (latest by date) GitHub release (latest by date including pre-releases)

image

Environment

CleanShot 2023-01-25 at 11 58 02@2x

Xcode Local

Tested on Latest Compatible
iOS 16 > 14

Apple Watch is well-known not supported. iPad / Mac is compatible with CoreNFC but there is no hardware to support this feature. ๐Ÿ˜‚

Xcode Cloud โ˜๏ธ

Compatible โœ…

Xcode Cloud requires Apple Developer Program membership.

Guide

Full Tutorial on Medium

Preparation

  1. Add to your project via Package Manager.

CleanShot 2023-01-25 at 12 23 13@2x

  1. Add Near Field Communication Tag Reading (aka NFC) into the Project's Combilities.

CleanShot 2023-01-25 at 12 30 23@2x

  1. Add NFC Privacy into Info.plist

CleanShot 2023-01-25 at 18 35 58@2x

Basic Usage

  1. Import first.
import SwiftNFC
  1. Add ObservedObject before body or any some View.

Read

@ObservedObject var NFCR = NFCReader()

Write

@ObservedObject var NFCW = NFCWriter()

Functions

func read() {
    NFCR.read()
}
func write() {
    NFCW.msg = NFCR.msg
    NFCW.write()
}

Demo

Path: ./Demo (Xcode Project in SwiftUI)

License

MIT

FAQ

Q1. How can I contribute to the project?
A1. Simply pull a request, and someone will review your code. If everything is okay, your changes will be merged and reflected in the next minor version.
Q2. Can I use it in Educational (includ. Student's Homework, Class's demo) or NGO or Commerical Project?
A2. YES. This project is under license of MIT. Feel free to use it :)

swiftnfc's People

Contributors

1998code avatar imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftnfc's Issues

class "NFFieldNotificationECP2_0" not loaded or does not exist

I am getting this issue can you please check this :

<NSXPCConnection: 0x303f9c640> connection to service with pid 60 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message.
Exception: Exception while decoding argument 0 (#2 of invocation):
Exception: decodeObjectForKey: class "NFFieldNotificationECP2_0" not loaded or does not exist

Delegate does not implement -readerSessionDidBecomeActive: method

Hi,
with version 1.3.0 when I scan a nfc tag I receive on Xcode console the following error:

-[NFCNDEFReaderSession _callbackDidBecomeActive]:220 Delegate does not implement -readerSessionDidBecomeActive: method

the issue seems to be in the empty body of this function:

public func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) {
}

It is possible to solve it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.