Skip to content

Commit 4a2b9c0

Browse files
authored
Merge pull request #300 from NordicSemiconductor/develop
Version 4.4.2
2 parents 53c7942 + c6ce77e commit 4a2b9c0

File tree

6 files changed

+28
-12
lines changed

6 files changed

+28
-12
lines changed

Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "weichsel/ZIPFoundation" ~> 0.9.9
1+
github "weichsel/ZIPFoundation" == 0.9.9

Example/Pods/Target Support Files/iOSDFULibrary-iOS/iOSDFULibrary-iOS-Info.plist

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/iOSDFULibrary-macOS/iOSDFULibrary-macOS-Info.plist

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

changelog renamed to changelog.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
### Changelog
2+
- **4.4.2**
3+
- Bugfix: Missing buttonless service statuses added (#297)
4+
- Improvement: Added support for older Swift versions (#295)
5+
- Improvement: ZIPFoundation dependency bound to 0.9.9.
6+
27
- **4.4.1**
38
- Bugfix: Fixed calculatign number of bytes received from PRN (#288).
4-
- Improvement: ZIPFoundation dependency upgraded to 0.9.9. (#281)
9+
- Improvement: ZIPFoundation dependency upgraded to 0.9.9. (#281)
510

611
- **4.4.0**
712
- Improvement: Swift 5.0 migration.

iOSDFULibrary.podspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "iOSDFULibrary"
3-
s.version = "4.4.1"
3+
s.version = "4.4.2"
44
s.summary = "This repository contains a tested library for iOS 9+ devices to perform Device Firmware Update on the nRF5x devices"
55
s.description = <<-DESC
66
The nRF5x Series chips are flash-based SoCs, and as such they represent the most flexible solution available. A key feature of the nRF5x Series and their associated software architecture and S-Series SoftDevices is the possibility for Over-The-Air Device Firmware Upgrade (OTA-DFU). See Figure 1. OTA-DFU allows firmware upgrades to be issued and downloaded to products in the field via the cloud and so enables OEMs to fix bugs and introduce new features to products that are already out on the market. This brings added security and flexibility to product development when using the nRF5x Series SoCs.
@@ -18,5 +18,5 @@ The nRF5x Series chips are flash-based SoCs, and as such they represent the most
1818

1919
s.source_files = 'iOSDFULibrary/Classes/**/*'
2020

21-
s.dependency 'ZIPFoundation', '~> 0.9.9'
21+
s.dependency 'ZIPFoundation', '= 0.9.9'
2222
end

iOSDFULibrary/Classes/Utilities/Data.swift

+17-6
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ extension Data {
3232
/// - returns: The value of type of the return type.
3333
func asValue<R>(offset: Int = 0) -> R {
3434
let length = MemoryLayout<R>.size
35-
return subdata(in: offset ..< offset + length).withUnsafeBytes {
36-
$0.baseAddress!.bindMemory(to: R.self, capacity: 1).pointee
37-
}
35+
36+
#if swift(>=5.0)
37+
return subdata(in: offset ..< offset + length).withUnsafeBytes { $0.load(as: R.self) }
38+
#else
39+
return subdata(in: offset ..< offset + length).withUnsafeBytes { $0.pointee }
40+
#endif
3841
}
3942

4043
}
@@ -46,14 +49,22 @@ extension Data {
4649
/// Returns the Data as hexadecimal string.
4750
var hexString: String {
4851
var array: [UInt8] = []
49-
self.withUnsafeBytes {
50-
array.append(contentsOf: $0)
51-
}
52+
53+
#if swift(>=5.0)
54+
withUnsafeBytes { array.append(contentsOf: $0) }
55+
#else
56+
withUnsafeBytes { array.append(contentsOf: getByteArray($0)) }
57+
#endif
5258

5359
return array.reduce("") { (result, byte) -> String in
5460
result + String(format: "%02x", byte)
5561
}
5662
}
63+
64+
private func getByteArray(_ pointer: UnsafePointer<UInt8>) -> [UInt8] {
65+
let buffer = UnsafeBufferPointer<UInt8>(start: pointer, count: count)
66+
return [UInt8](buffer)
67+
}
5768

5869
}
5970

0 commit comments

Comments
 (0)