Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
jvk75 committed Oct 10, 2017
1 parent e983bf5 commit cd0adb7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,30 @@ pod 'NFCNDEFParse'

## Usage

Import the library.

```
import NFCNDEFParse
```

...
Create array for the messages

var data: NDEFMessageWithWellKnownTypes?
```
var data: [NDEFMessageWithWellKnownTypes] = []
```

...
In CoreNFC callback create the "well know types" data array.

```
func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {
for message in messages {
data = NDEFMessageWithWellKnownTypes(records: message.records)
}
data = messages.flatMap({ NDEFMessageWithWellKnownTypes(records: $0.records) })
}
```

...
Loop through the data array to print out the values.

data?.records.forEach({ record in
```
data.records.forEach({ record in
if record.type == .text, let record = record as? NFCForumWellKnownTypeTextProtocol {
print(record.string)
print(record.locale)
Expand Down

0 comments on commit cd0adb7

Please sign in to comment.