Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yanngodeau committed May 21, 2021
0 parents commit ac90198
Show file tree
Hide file tree
Showing 13 changed files with 1,010 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

# General
.DS_Store
.AppleDouble
.LSOverride

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 yanngodeau

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SimplyNFC",
platforms: [
.iOS("14.0")
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SimplyNFC",
targets: ["SimplyNFC"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SimplyNFC",
dependencies: []),
.testTarget(
name: "SimplyNFCTests",
dependencies: ["SimplyNFC"]),
]
)
91 changes: 91 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# SimplyNFC

Simply read and write NFC tags with iPhone (iOS 14.0+)

[![GitHub license](https://img.shields.io/github/license/yanngodeau/SimplyNFC)](https://github.com/yanngodeau/SimplyNFC/blob/main/LICENSE)
[![Platform](https://img.shields.io/badge/plateform-iOS-yellow)](https://github.com/yanngodeau/SimplyNFC)
[![Swift](https://img.shields.io/badge/swift-5.1%2B-orange)](https://swift.org)


## Installation

### Swift package manager

Go to `File | Swift Packages | Add Package Dependency...` in Xcode and search for « SimplyNFC »

### Cathage

You can use [Carthage](https://github.com/Carthage/Carthage) to install `SimplyNFC` by adding it to your `Cartfile`.

```swift
github "yanngodeau/SimplyNFC"
```

### Manual

1. Put SimplyNFC repo somewhere in your project directory.
2. In Xcode, add `SimplyNFC.xcodeproj` to your project
3. On your app's target, add the SwiftMessages framework:
1. as an embedded binary on the General tab.
2. as a target dependency on the Build Phases tab.

## Usage

### Read tag

Reading NCFNDEFMessage from tag

```swift
import SimplyNFC

let nfcManager = NFCManager()
nfcManager.read { manager in
// Session did become active
nfcManager.setMessage("👀 Place iPhone near the tag to read")
} didDetect: { manager, result in
switch result {
case .failure:
nfcManager.setMessage("👎 Failed to read tag")
case .success:
nfcManager.setMessage("🙌 Tag read successfully")
}
```

### Write on tag

Writing NFCNDEFMessage on tag

```swift
import SimplyNFC

let nfcManager = NFCManager()
nfcManager.write(message: ndefMessage) { manager in
// Session did become active
nfcManager.setMessage("👀 Place iPhone near the tag to be written on")
} didDetect: { manager, result in
switch result {
case .failure:
nfcManager.setMessage("👎 Failed to write tag")
case .success:
nfcManager.setMessage("🙌 Tag successfully written")
}
```

## Contribute

- Fork it!
- Create your feature branch: `git checkout -b my-new-feature`
- Commit your changes: `git commit -am 'Add some feature'`
- Push to the branch: `git push origin my-new-feature`
- Submit a pull request

## License

SimplyNFC is distributed under the [MIT License](https://mit-license.org).

## Author

- Yann Godeau - [@yanngodeau](https://github.com/yanngodeau)

Based on code by [@tattn](https://github.com/tattn)

Loading

0 comments on commit ac90198

Please sign in to comment.