Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developeracademy-postech/2024-nc2-m1-nfc


https://github.com/developeracademy-postech/2024-nc2-m1-nfc

Last synced: about 10 hours ago
JSON representation

Awesome Lists containing this project

README

        

## ๐ŸŽฅ Youtube Link
(์ถ”ํ›„ ๋งŒ๋“ค์–ด์ง„ ์œ ํŠœ๋ธŒ ๋งํฌ ์ถ”๊ฐ€)

## ๐Ÿ’ก About Augmented Reality

๐Ÿ’ก **NFC๋ž€?**

NFC๋Š” near field communication์˜ ์ค„์ž„๋ง๋กœ, ๊ทผ๊ฑฐ๋ฆฌ ํ†ต์‹  ๊ธฐ์ˆ ์„ ๋งํ•จ.

Nfc ๊ธฐ์ˆ ์„ ์ด์šฉํ•˜์—ฌ 10cm์ด๋‚ด์˜ ๋งค์šฐ ๊ฐ€๊นŒ์šด ๊ฑฐ๋ฆฌ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ตํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

**โœ…NFC ํ™œ์šฉ ๋ฐฉ๋ฒ•**

1๏ธโƒฃย ๋ฐ์ดํ„ฐ ๊ตํ™˜

- NameDrop๊ณผ Airdrop ๊ฐ™์ด nfc๋ฅผ ์ด์šฉํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ๊ตํ™˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. (airdrop์€ wifi ์ด์šฉํ•˜๋Š” ๊ฑด๋ฐ, iOS17 ์ด์ƒ๋ถ€ํ„ฐ airdrop์„ nfc๋กœ๋„ ์ด์šฉ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.)

2๏ธโƒฃย ๊ฒฐ์ œ ์‹œ์Šคํ…œ

- Apple Pay์™€ ํ‹ฐ๋จธ๋‹ˆ ๊ตํ†ต์นด๋“œ ์Šคํ‹ฐ์ปค

3๏ธโƒฃย ๋‹จ์ถ•์–ด / ์ •๋ณด ํ™•์ธ

- ์•„์ดํฐ ๋‹จ์ถ•์–ด์™€ NFC ์Šคํ‹ฐ์ปค๋ฅผ ์—ฐ๊ฒฐํ•˜์—ฌ ํƒœ๊น…ํ–ˆ์„ ๋•Œ ์›ํ•˜๋Š” ํ–‰๋™์„ ํ•˜๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- ๋ฆฌ๋”๊ธฐ์— ํ•ธ๋“œํฐ์„ ํƒœ๊น…ํ•ด ๋‹ค์–‘ํ•œ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

## ๐ŸŽฏ What we focus on?

๐Ÿช Tag reader์™€ ์•„์ดํฐ์— ์ง‘์ค‘

- ๋‹ค์–‘ํ•œ ํ™œ์šฉ ๋ฐฉ๋ฒ• ์ค‘ ํ•˜๋“œ์›จ์–ด์™€ ์•ฑ์˜ ์—ฐ๋™์„ ํ•ด๋ณด๊ณ  ์‹ถ์–ด์„œ ๋ฆฌ๋”๊ธฐ์— ํ•ธ๋“œํฐ์„ ํƒœ๊น…ํ–ˆ์„ ๋•Œ ์ •๋ณด๊ฐ€ ๋œจ๋Š” ๊ฒƒ์— ์ง‘์ค‘ํ•˜์˜€์Šต๋‹ˆ๋‹ค.

## ๐Ÿ’ผ Use Case

๐ŸŒŽ **NFC ํƒœ๊ทธ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋ฏธํŒ…๋ฃธ์„ ์˜ˆ์•ฝํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“ค์ž!**

- who : ๋ฏธํŒ…๋ฃธ์„ ์‚ฌ์šฉํ•˜๋ ค๋Š” ์•„์นด๋ฐ๋ฏธ์ƒ&์‹œ๋‹ˆ์–ด ๋Ÿฌ๋„ˆ
- when: ๋ฏธํŒ…๋ฃธ ์˜ˆ์•ฝ์ด ํ•„์š”ํ•  ๋•Œ
- how: nfc ํƒœ๊ทธ๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๊ฐ ๋ฏธํŒ…๋ฃธ ์˜ˆ์•ฝ ํŽ˜์ด์ง€๋ฅผ ํ†ตํ•ด ๋‹น์ผ์˜ˆ์•ฝํ•จ.

## ๐Ÿ–ผ๏ธ Prototype
### 1. ํƒœ๊น…

- ์•ฑ์— ๋“ค์–ด๊ฐ€์„œ โ€œ์Šค์บ”ํ•˜๊ธฐโ€ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๊ฐ ๋ฏธํŒ…๋ฃธ ์•ž์— ๋ถ™์–ด์žˆ๋Š” NFC ์Šคํ‹ฐ์ปค์— ํ•ธ๋“œํฐ์„ ๊ฐ€๊นŒ์ด ๊ฐ€์ ธ๊ฐ‘๋‹ˆ๋‹ค.

![2 %20%E1%84%89%E1%85%B3%E1%84%8F%E1%85%A2%E1%86%AB%20%E1%84%87%E1%85%B2](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/d9ee362c-2c54-4d7c-99a6-5b4b34a87ab0)
![2 %20%E1%84%89%E1%85%B3%E1%84%8F%E1%85%A2%E1%86%AB%20%E1%84%87%E1%85%B2-1](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/6e95d6e7-b767-4fae-ad01-5fd07ab830a1)

### 2. ๋ฉ”์ธํŽ˜์ด์ง€

- ์„ฑ๊ณต์ ์œผ๋กœ ์Šค์บ”์ด ๋˜๋ฉด ๋ฉ”์ธํŽ˜์ด์ง€์— ํ•ด๋‹น ๋ฏธํŒ…๋ฃธ์— ๋Œ€ํ•œ ์˜ˆ์•ฝํŽ˜์ด์ง€๊ฐ€ ๋œน๋‹ˆ๋‹ค.
- ์˜ˆ์•ฝํ•˜๊ณ  ์‹ถ์€ ์‹œ๊ฐ„๋Œ€ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

![2 %20%E1%84%91%E1%85%AD(%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%A9%E1%86%AFx)-1](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/4e92de3f-7077-44ad-b7c9-816619984f14)
![2 %20%E1%84%91%E1%85%AD(%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%A9%E1%86%AFx)-2](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/6b206dfc-222d-492e-bd8f-f2ccf776194a)

### 3. ์˜ˆ์•ฝํ•˜๊ธฐ

- ์˜ˆ์•ฝํ•˜๊ธฐ๋ฅผ ๋ˆ„๋ฅด๋ฉด ์˜ˆ์•ฝ์ฐฝ์ด ๋œน๋‹ˆ๋‹ค. ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

![iPhone%2014%20%26%2015%20Pro%20-%20%E1%84%8B%E1%85%A8%E1%84%8B%E1%85%A3%E1%86%A8%E1%84%92%E1%85%AA%E1%84%86%E1%85%A7%E1%86%AB](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/052dc221-6232-410a-9e85-1c53c216cc40)
![iPhone%2014%20%26%2015%20Pro%20-%20%E1%84%8B%E1%85%A8%E1%84%8B%E1%85%A3%E1%86%A8%E1%84%92%E1%85%AA%E1%84%86%E1%85%A7%E1%86%AB_%20%E1%84%8B%E1%85%A8%E1%84%8B%E1%85%A3%E1%86%A8%20%E1%84%8B%E1%85%B5%E1%86%AB%E1%84%8B%E1%85%AF%E1%86%AB-1](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/4079e435-13ea-43ce-a16f-332e91cab22f)

### 4. ์ˆ˜์ • / ์‚ญ์ œํ•˜๊ธฐ
![2 %20%E1%84%91%E1%85%AD(%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%A9%E1%86%AFx)](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/29085645-e39e-4ec6-9cda-864bd2601f74)
![iPhone%2014%20%26%2015%20Pro%20-%20%E1%84%89%E1%85%AE%E1%84%8C%E1%85%A5%E1%86%BC%E1%84%92%E1%85%AA%E1%84%86%E1%85%A7%E1%86%AB](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/34a9307d-3eac-48bc-9497-706d592fbdf8)

![iPhone%2014%20%26%2015%20Pro%20-%20%E1%84%8B%E1%85%A8%E1%84%8B%E1%85%A3%E1%86%A8%E1%84%92%E1%85%AA%E1%84%86%E1%85%A7%E1%86%AB_%20%E1%84%8B%E1%85%A8%E1%84%8B%E1%85%A3%E1%86%A8%20%E1%84%8B%E1%85%B5%E1%86%AB%E1%84%8B%E1%85%AF%E1%86%AB](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/f5c80f1d-bfca-428b-acfd-bae7bd01436b)
![2 %20%E1%84%91%E1%85%AD(%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%A9%E1%86%AFx)-3](https://github.com/DeveloperAcademy-POSTECH/2024-NC2-M1-NFC/assets/160375101/94290cc0-bcef-4bcb-a751-b2f6955f8d17)

##

## ๐Ÿ› ๏ธ About Code

แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-06-20 แ„‹แ…ฉแ„’แ…ฎ 10 38 45

**NFC ํƒœ๊ทธ ์ฝ๊ธฐ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ํ•„์š”ํ•œ ํ•ต์‹ฌ ๊ธฐ๋Šฅ ์‹œ๊ฐํ™” ํ•œ ์ž๋ฃŒ์ž…๋‹ˆ๋‹ค.**

``` swift
private func startNFCTagging() {
let session = NFCTagReaderSession(pollingOption: .iso14443, delegate: NFCFeature.shared)
session?.begin()
}

class NFCFeature: NSObject, NFCTagReaderSessionDelegate {
static let shared = NFCFeature()

var completeNavigate: (() -> Void)?

func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
print("become active")
}

func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: any Error) {
if let readerError = error as? NFCReaderError, readerError.code != .readerSessionInvalidationErrorFirstNDEFTagRead {
print("NFC Reader session ์˜ค๋ฅ˜ \(error.localizedDescription)")
}
}

func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
print(tags)
if let completeNavigate {
completeNavigate()
}
session.invalidate()
}


}
```

**์œ„ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด ์ž‘์„ฑ๋œ NFC ๊ธฐ์ˆ ์˜ ํ•ต์‹ฌ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•œ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.**

NFC ํƒœ๊ทธ๋ฅผ ๊ฐ์ง€ํ•˜๊ณ , ๊ฐ์ง€๋œ ํƒœ๊ทธ๊ฐ€ ์žˆ์„ ๋•Œ ํŠน์ • ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค. ํƒœ๊ทธ๋ฅผ ์ฝ๋Š” ๊ฒƒ์„ ๋ชฉํ‘œ๋กœํ•˜๋Š” ๋ณธ ์ฝ”๋“œ๋Š” ํฌ๊ฒŒ NFC ํƒœ๊ทธ์˜ ๊ฐ์ง€๋ฅผ ์‹œ์ž‘ํ•˜๋Š” ๋‹จ๊ณ„์™€ NFC ํƒœ๊ทธ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๋‹จ๊ณ„๋กœ ๋ถ„๋ฆฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

``` swift
private func startNFCTagging() {
let session = NFCTagReaderSession(pollingOption: .iso14443, delegate: NFCFeature.shared)
session?.begin()
}
```

**NFC ํƒœ๊ทธ์˜ ๊ฐ์ง€๋ฅผ ์‹œ์ž‘ํ•˜๋Š” ๋ฉ”์„œ๋“œ์˜ ์ฝ”๋“œ๋Š” ํ‘œ์‹œํ•œ ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค.**

NFCTagReaderSession์ด๋ž€ CoreNFC ํ”„๋ ˆ์ž„์›Œํฌ์˜ ํด๋ž˜์Šค ์ค‘ ํ•˜๋‚˜๋กœ, ๋‹ค์–‘ํ•œ NFC ํƒœ๊ทธ๋ฅผ ๊ฒ€์ƒ‰ํ•˜๊ณ  ์ƒํ˜ธ์ž‘์šฉ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ค๋‹ˆ๋‹ค.

``` swift
class NFCFeature: NSObject, NFCTagReaderSessionDelegate {
static let shared = NFCFeature()

var completeNavigate: (() -> Void)?

func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
print("become active")
}

func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: any Error) {
if let readerError = error as? NFCReaderError, readerError.code != .readerSessionInvalidationErrorFirstNDEFTagRead {
print("NFC Reader session ์˜ค๋ฅ˜ \(error.localizedDescription)")
}
}

func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
print(tags)
if let completeNavigate {
completeNavigate()
}
session.invalidate()
}


}
```

**NFC ํƒœ๊ทธ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๋‹จ๊ณ„๋Š”, ํ‘œ์‹œํ•œ ์ฝ”๋“œ์™€ ๊ฐ™์ด ํ‘œํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.**

NFCFeature class๋Š” NFCTagReaderSessiondelegate protocol์„ ์ฑ„ํƒํ•˜์—ฌ NFC ํƒœ๊ทธ ๊ฐ์ง€์™€ ๊ด€๋ จ๋œ ์ด๋ฒคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

``` swift
func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: any Error) {
if let readerError = error as? NFCReaderError, readerError.code != .readerSessionInvalidationErrorFirstNDEFTagRead {
print("NFC Reader session ์˜ค๋ฅ˜ \(error.localizedDescription)")
}
}
```

**NFC ํƒœ๊ทธ๋ฅผ ๊ฐ์ง€ ํ•˜๋Š” ๋™์•ˆ ์ƒ๊ธฐ๋Š” ์˜ค๋ฅ˜๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฉ”์„œ๋“œ๋ฅผ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.**

์ด ๋ฉ”์„œ๋“œ๋Š” NFC ๋ฆฌ๋” ์„ธ์…˜์ด ์˜ค๋ฅ˜๋กœ ์ธํ•ด ๋ฌดํšจํ™”๋˜์—ˆ์„ ๋•Œ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค.

``` swift
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
print(tags)
if let completeNavigate {
completeNavigate()
}
session.invalidate()
}
```

**NFC ํƒœ๊ทธ ๊ฐ์ง€ ํ›„ ์ด๋ฒคํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ์ฝ”๋“œ์ž…๋‹ˆ๋‹ค.**

์ด ๋ฉ”์„œ๋“œ๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ NFC ํƒœ๊ทธ๊ฐ€ ๊ฐ์ง€ ๋˜์—ˆ์„ ๋•Œ ํ˜ธ์ถœ๋˜๊ณ , ๊ฐ์ง€๋œ ํƒœ๊ทธ์˜ ๋ชฉ๋ก์„ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์•ฝ ํด๋กœ์ €๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ์œผ๋ฉด ์ด๋ฅผ ํ˜ธ์ถœํ•˜๊ณ  ์ดํ›„ ์„ธ์…˜์„ ๋ฌดํšจํ™”ํ•ฉ๋‹ˆ๋‹ค.