Skip to content

Commit

Permalink
Remove cryptoswift and update to ios 13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Borraccino committed Apr 14, 2021
1 parent 36d5a69 commit 9f9370e
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 104 deletions.
26 changes: 9 additions & 17 deletions Data4LifeFHIR.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,6 @@
35FC867193706FA9EACBEBC3 /* (null) in Resources */ = {isa = PBXBuildFile; };
360ED7A4870B0B6C4AC6FF12 /* (null) in Resources */ = {isa = PBXBuildFile; };
3611A9E17EA9EBACC418C358 /* (null) in Sources */ = {isa = PBXBuildFile; };
3613AB53260CB6940016474D /* CryptoSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3613AB52260CB6940016474D /* CryptoSwift */; };
3613AB55260CB6940016474D /* Data4LifeSDKUtils in Frameworks */ = {isa = PBXBuildFile; productRef = 3613AB54260CB6940016474D /* Data4LifeSDKUtils */; };
36242E3F12A1A5C8DEB29425 /* TaskExample4+Test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10F6A32F140F3CD9D1AC2D16 /* TaskExample4+Test.swift */; };
36276F6107C30A866C1A17B3 /* (null) in Sources */ = {isa = PBXBuildFile; };
Expand Down Expand Up @@ -5734,7 +5733,6 @@
buildActionMask = 2147483647;
files = (
3613AB55260CB6940016474D /* Data4LifeSDKUtils in Frameworks */,
3613AB53260CB6940016474D /* CryptoSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -7355,7 +7353,6 @@
);
name = Data4LifeFHIR;
packageProductDependencies = (
3613AB52260CB6940016474D /* CryptoSwift */,
3613AB54260CB6940016474D /* Data4LifeSDKUtils */,
);
productName = HCFHIR;
Expand Down Expand Up @@ -11896,13 +11893,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FhirR4/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = de.gesundheitscloud.ModelsR4;
Expand All @@ -11929,13 +11926,13 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FhirR4/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = de.gesundheitscloud.ModelsR4;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down Expand Up @@ -12130,14 +12127,14 @@
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = FhirStu3/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
PRODUCT_BUNDLE_IDENTIFIER = de.gesundheitscloud.HCFHIR;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -12168,14 +12165,14 @@
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = FhirStu3/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
"IPHONEOS_DEPLOYMENT_TARGET[sdk=macosx*]" = 13.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
PRODUCT_BUNDLE_IDENTIFIER = de.gesundheitscloud.HCFHIR;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -12292,17 +12289,12 @@
repositoryURL = "git@github.com:d4l-data4life/d4l-utils-ios.git";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 0.4.0;
minimumVersion = 0.5.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3613AB52260CB6940016474D /* CryptoSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 3613AB51260CB6940016474D /* XCRemoteSwiftPackageReference "d4l-utils-ios" */;
productName = CryptoSwift;
};
3613AB54260CB6940016474D /* Data4LifeSDKUtils */ = {
isa = XCSwiftPackageProductDependency;
package = 3613AB51260CB6940016474D /* XCRemoteSwiftPackageReference "d4l-utils-ios" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"repositoryURL": "git@github.com:d4l-data4life/d4l-utils-ios.git",
"state": {
"branch": null,
"revision": "c4c94e97e0a1847b9de78c32aa8858511e4b0bb8",
"version": "0.4.0"
"revision": "02206ce8d9644c0731f6487d9330aba715400f6e",
"version": "0.5.0"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions FhirR4/Sources/FMCore/FHIRParserError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import Foundation

public struct FHIRParserErrorPosition: CustomStringConvertible {
public let string: String
public let location: Int
public let location: String.Index

public init(string: String, location: Int) {
public init(string: String, location: String.Index) {
self.string = string
self.location = location
}
Expand Down
4 changes: 2 additions & 2 deletions FhirR4/Sources/FMCore/Scanner+FHIR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public extension Scanner {
if #available(macOS 10.15, *), #available(iOS 13, *), #available(watchOS 6, *), #available(tvOS 13, *) {
return scanCharacters(from: characterSet)
}
var string: NSString?
if scanCharacters(from: characterSet, into: &string), let string = string {
if let string = scanCharacters(from: characterSet) {
return String(string)
}
return nil
Expand Down
28 changes: 14 additions & 14 deletions FhirR4/Sources/FMCore/TimeZone+FHIR.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public extension TimeZone {
scanner.charactersToBeSkipped = nil

let plusMinusZ = CharacterSet(charactersIn: "+-Z")
var scanLocation = scanner.scanLocation
var currentIndex = scanner.currentIndex
guard let tzPrefix = scanner.hs_scanCharacters(from: plusMinusZ) else {
throw FHIRDateParserError.invalidTimeZonePrefix(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZonePrefix(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

let secondsFromGMT: Int
Expand All @@ -56,34 +56,34 @@ public extension TimeZone {
timeZoneString = tzPrefix
} else {
let numbers = CharacterSet.decimalDigits
scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
guard let hourString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard hourString.count == 2 else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + min(2, hourString.count)))
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.string.index(currentIndex, offsetBy: min(2, hourString.count))))
}
guard let hour = Int(hourString), hour <= 14 else {
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

scanLocation = scanner.scanLocation
guard scanner.scanString(":", into: nil) else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
currentIndex = scanner.currentIndex
guard scanner.scanString(":") != nil else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
guard let minuteString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard minuteString.count <= 2 else {
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + min(2, minuteString.count)))
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanner.string.index(currentIndex, offsetBy: min(2, minuteString.count))))
}
guard minuteString.count == 2, let minute = Int(minuteString), minute <= 59 else {
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard hour < 14 || minute == 0 else {
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneMinute(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

secondsFromGMT = (("-" == tzPrefix) ? -1 : 1) * ((3600 * hour) + (60 * minute))
Expand Down
6 changes: 3 additions & 3 deletions FhirR4/Sources/ModelsR4/DateTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public struct DateTime: FHIRPrimitiveType {
var timeZoneString: String?

// Time
if scanner.scanString("T", into: nil) {
if scanner.scanString("T") != nil {
time = try FHIRTime.parse(from: scanner, expectAtEnd: false)

// TimeZone
Expand All @@ -91,9 +91,9 @@ public struct DateTime: FHIRPrimitiveType {
}

// At end
let scanLocation = scanner.scanLocation
let currentIndex = scanner.currentIndex
if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

return (date, time, timeZone, timeZoneString)
Expand Down
20 changes: 10 additions & 10 deletions FhirR4/Sources/ModelsR4/FHIRDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,32 @@ public struct FHIRDate: FHIRPrimitiveType {
scanner.charactersToBeSkipped = nil
let numbers = CharacterSet.decimalDigits

var scanLocation = scanner.scanLocation
var currentIndex = scanner.currentIndex
guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 4, let year = Int(scanned), year > 0 else {
throw FHIRDateParserError.invalidYear(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidYear(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

var month: UInt8?
var day: UInt8?
if scanner.scanString("-", into: nil) {
scanLocation = scanner.scanLocation
if scanner.scanString("-") != nil {
currentIndex = scanner.currentIndex
guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 2, let scanMonth = UInt8(scanned), (1...12).contains(scanMonth) else {
throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
month = scanMonth

if scanner.scanString("-", into: nil) {
scanLocation = scanner.scanLocation
if scanner.scanString("-") != nil {
currentIndex = scanner.currentIndex
guard let scanned = scanner.hs_scanCharacters(from: numbers), scanned.count == 2, let scanDay = UInt8(scanned), (1...31).contains(scanDay) else {
throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
day = scanDay
}
}

scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

return (year, month, day)
Expand Down
50 changes: 25 additions & 25 deletions FhirR4/Sources/ModelsR4/FHIRTime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,70 +94,70 @@ public struct FHIRTime: FHIRPrimitiveType {
let numbers = CharacterSet.decimalDigits

// Hours
var scanLocation = scanner.scanLocation
var currentIndex = scanner.currentIndex
guard let hourString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard hourString.count == 2 else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + hourString.count))
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.string.index(currentIndex, offsetBy: hourString.count)))
}
guard let hour = UInt8(hourString), hour <= 23 else {
throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidHour(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

scanLocation = scanner.scanLocation
guard scanner.scanString(":", into: nil) else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
currentIndex = scanner.currentIndex
guard scanner.scanString(":") != nil else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

// Minutes
scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
guard let minuteString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard minuteString.count == 2 else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + minuteString.count))
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.string.index(currentIndex, offsetBy: minuteString.count)))
}
guard let minute = UInt8(minuteString), minute <= 59 else {
throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidMinute(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

scanLocation = scanner.scanLocation
guard scanner.scanString(":", into: nil) else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
currentIndex = scanner.currentIndex
guard scanner.scanString(":") != nil else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

// Seconds
scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
guard let fullSecondString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
guard fullSecondString.count == 2 else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanLocation + fullSecondString.count))
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.string.index(currentIndex, offsetBy: fullSecondString.count)))
}
guard let scanSecondAlone = Int(fullSecondString), scanSecondAlone <= 60 else {
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

let secondString: String
scanLocation = scanner.scanLocation
if scanner.scanString(".", into: nil) {
scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
if scanner.scanString(".") != nil {
currentIndex = scanner.currentIndex
guard let subSecondString = scanner.hs_scanCharacters(from: numbers) else {
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
secondString = "\(fullSecondString).\(subSecondString)"
} else {
secondString = fullSecondString
}
guard let second = Decimal(string: secondString), second <= 60.0 else {
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidSecond(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

// End
scanLocation = scanner.scanLocation
currentIndex = scanner.currentIndex
if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

return (hour, minute, second, secondString)
Expand Down
10 changes: 5 additions & 5 deletions FhirR4/Sources/ModelsR4/Instant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,20 @@ public struct Instant: FHIRPrimitiveType {

// Date, Time & TimeZone
let date = try InstantDate.parse(from: scanner, expectAtEnd: false)
guard scanner.scanString("T", into: nil) else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation))
guard scanner.scanString("T") != nil else {
throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.currentIndex))
}

let scanLocation = scanner.scanLocation
let currentIndex = scanner.currentIndex
let time = try FHIRTime.parse(from: scanner, expectAtEnd: false)
let (secondsFromGMT, timeZoneString) = try TimeZone.hs_parseComponents(from: scanner, expectAtEnd: true)
guard let timeZone = TimeZone(secondsFromGMT: secondsFromGMT) else { // we should never hit this since `TimeZone.hs_parseComponents` takes care of validation
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
throw FHIRDateParserError.invalidTimeZoneHour(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}

// Done
if expectAtEnd && !scanner.isAtEnd { // it's OK if we don't `expectAtEnd` but the scanner actually is
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation))
throw FHIRDateParserError.additionalCharacters(FHIRParserErrorPosition(string: scanner.string, location: scanner.currentIndex))
}

return (date, time, timeZone, timeZoneString)
Expand Down
Loading

0 comments on commit 9f9370e

Please sign in to comment.