diff --git a/Cartfile b/Cartfile
index 00905599..01b02ac1 100644
--- a/Cartfile
+++ b/Cartfile
@@ -1 +1 @@
-github "weichsel/ZIPFoundation" ~> 0.9.9
\ No newline at end of file
+github "weichsel/ZIPFoundation" == 0.9.9
\ No newline at end of file
diff --git a/Example/Pods/Target Support Files/iOSDFULibrary-iOS/iOSDFULibrary-iOS-Info.plist b/Example/Pods/Target Support Files/iOSDFULibrary-iOS/iOSDFULibrary-iOS-Info.plist
index 5db6b8f6..2da49017 100644
--- a/Example/Pods/Target Support Files/iOSDFULibrary-iOS/iOSDFULibrary-iOS-Info.plist
+++ b/Example/Pods/Target Support Files/iOSDFULibrary-iOS/iOSDFULibrary-iOS-Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 4.4.1
+ 4.4.2
CFBundleSignature
????
CFBundleVersion
diff --git a/Example/Pods/Target Support Files/iOSDFULibrary-macOS/iOSDFULibrary-macOS-Info.plist b/Example/Pods/Target Support Files/iOSDFULibrary-macOS/iOSDFULibrary-macOS-Info.plist
index 5db6b8f6..2da49017 100644
--- a/Example/Pods/Target Support Files/iOSDFULibrary-macOS/iOSDFULibrary-macOS-Info.plist
+++ b/Example/Pods/Target Support Files/iOSDFULibrary-macOS/iOSDFULibrary-macOS-Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 4.4.1
+ 4.4.2
CFBundleSignature
????
CFBundleVersion
diff --git a/changelog b/changelog.md
similarity index 97%
rename from changelog
rename to changelog.md
index 3ddf42b1..af5afa72 100644
--- a/changelog
+++ b/changelog.md
@@ -1,7 +1,12 @@
### Changelog
+- **4.4.2**
+ - Bugfix: Missing buttonless service statuses added (#297)
+ - Improvement: Added support for older Swift versions (#295)
+ - Improvement: ZIPFoundation dependency bound to 0.9.9.
+
- **4.4.1**
- Bugfix: Fixed calculatign number of bytes received from PRN (#288).
-- Improvement: ZIPFoundation dependency upgraded to 0.9.9. (#281)
+ - Improvement: ZIPFoundation dependency upgraded to 0.9.9. (#281)
- **4.4.0**
- Improvement: Swift 5.0 migration.
diff --git a/iOSDFULibrary.podspec b/iOSDFULibrary.podspec
index c1fb580b..1351b1fa 100644
--- a/iOSDFULibrary.podspec
+++ b/iOSDFULibrary.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "iOSDFULibrary"
- s.version = "4.4.1"
+ s.version = "4.4.2"
s.summary = "This repository contains a tested library for iOS 9+ devices to perform Device Firmware Update on the nRF5x devices"
s.description = <<-DESC
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
s.source_files = 'iOSDFULibrary/Classes/**/*'
- s.dependency 'ZIPFoundation', '~> 0.9.9'
+ s.dependency 'ZIPFoundation', '= 0.9.9'
end
diff --git a/iOSDFULibrary/Classes/Utilities/Data.swift b/iOSDFULibrary/Classes/Utilities/Data.swift
index d8d69d83..c5593ee9 100644
--- a/iOSDFULibrary/Classes/Utilities/Data.swift
+++ b/iOSDFULibrary/Classes/Utilities/Data.swift
@@ -32,9 +32,12 @@ extension Data {
/// - returns: The value of type of the return type.
func asValue(offset: Int = 0) -> R {
let length = MemoryLayout.size
- return subdata(in: offset ..< offset + length).withUnsafeBytes {
- $0.baseAddress!.bindMemory(to: R.self, capacity: 1).pointee
- }
+
+ #if swift(>=5.0)
+ return subdata(in: offset ..< offset + length).withUnsafeBytes { $0.load(as: R.self) }
+ #else
+ return subdata(in: offset ..< offset + length).withUnsafeBytes { $0.pointee }
+ #endif
}
}
@@ -46,14 +49,22 @@ extension Data {
/// Returns the Data as hexadecimal string.
var hexString: String {
var array: [UInt8] = []
- self.withUnsafeBytes {
- array.append(contentsOf: $0)
- }
+
+ #if swift(>=5.0)
+ withUnsafeBytes { array.append(contentsOf: $0) }
+ #else
+ withUnsafeBytes { array.append(contentsOf: getByteArray($0)) }
+ #endif
return array.reduce("") { (result, byte) -> String in
result + String(format: "%02x", byte)
}
}
+
+ private func getByteArray(_ pointer: UnsafePointer) -> [UInt8] {
+ let buffer = UnsafeBufferPointer(start: pointer, count: count)
+ return [UInt8](buffer)
+ }
}