@iotize/device-com-nfc.cordova 3.10.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iotize/device-com-nfc.cordova",
3
3
  "main": "bundles/iotize-device-com-nfc.cordova.umd.js",
4
- "version": "3.10.0",
4
+ "version": "3.10.1",
5
5
  "description": "Near Field Communication (NFC) Plugin. Read and write NDEF messages to NFC tags and share NDEF messages with peers.",
6
6
  "cordova": {
7
7
  "id": "@iotize/device-com-nfc.cordova",
@@ -1,18 +1,21 @@
1
1
  import CoreNFC
2
2
 
3
3
  public extension String {
4
-
5
- func dataFromHexString() -> Data {
4
+ func dataFromHexString() -> Data {
6
5
  var bytes = [UInt8]()
7
- for i in 0..<(count/2) {
8
- let range = index(self.startIndex, offsetBy: 2*i)..<index(self.startIndex, offsetBy: 2*i+2)
9
- let stringBytes = self[range]
10
- let byte = strtol((stringBytes as NSString).utf8String, nil, 16)
11
- bytes.append(UInt8(byte))
6
+ bytes.reserveCapacity(count / 2)
7
+
8
+ var index = startIndex
9
+ while index < endIndex {
10
+ let next = self.index(index, offsetBy: 2)
11
+ let byteString = String(self[index..<next])
12
+ let byte = UInt8(byteString, radix: 16)!
13
+ bytes.append(byte)
14
+ index = next
12
15
  }
13
- return Data(bytes: UnsafePointer<UInt8>(bytes), count:bytes.count)
16
+
17
+ return Data(bytes)
14
18
  }
15
-
16
19
  }
17
20
 
18
21
  public extension Data {
@@ -4,4 +4,4 @@
4
4
  //
5
5
  // (c) 2018 IoTize Solutions
6
6
 
7
- #import "../../../AppDelegate.h"
7
+ #import "../../../Classes/AppDelegate.h"