-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
50d7b60
commit 5dd5245
Showing
7 changed files
with
95 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
Sources/HealthDB/Database/HealthDatabase+HeartbeatSeries.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
Sources/HealthDB/Model/Audiogram/HKAudiogram+BinarySample.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Foundation | ||
import HealthKit | ||
|
||
extension HKAudiogramSample: BinarySample { | ||
|
||
static func from(object: ObjectData, data: Data) -> Self? { | ||
let points: [HKAudiogramSensitivityPoint] | ||
do { | ||
let decoder = try NSKeyedUnarchiver(forReadingFrom: data) | ||
decoder.requiresSecureCoding = false | ||
|
||
guard let values = decoder.decodeObject(of: NSArray.self, forKey: NSKeyedArchiveRootObjectKey) as? [HKAudiogramSensitivityPoint] else { | ||
return nil | ||
} | ||
points = values | ||
} catch { | ||
return nil | ||
} | ||
|
||
return .init(sensitivityPoints: points, start: object.startDate, end: object.endDate, metadata: object.metadata) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Foundation | ||
|
||
protocol BinarySample { | ||
|
||
static func from(object: ObjectData, data: Data) -> Self? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters