diff --git a/Data4LifeFHIR.xcodeproj/project.pbxproj b/Data4LifeFHIR.xcodeproj/project.pbxproj
index 3bff7d7..1865e24 100644
--- a/Data4LifeFHIR.xcodeproj/project.pbxproj
+++ b/Data4LifeFHIR.xcodeproj/project.pbxproj
@@ -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; };
@@ -5734,7 +5733,6 @@
buildActionMask = 2147483647;
files = (
3613AB55260CB6940016474D /* Data4LifeSDKUtils in Frameworks */,
- 3613AB53260CB6940016474D /* CryptoSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7355,7 +7353,6 @@
);
name = Data4LifeFHIR;
packageProductDependencies = (
- 3613AB52260CB6940016474D /* CryptoSwift */,
3613AB54260CB6940016474D /* Data4LifeSDKUtils */,
);
productName = HCFHIR;
@@ -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;
@@ -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)";
@@ -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 = "";
@@ -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 = "";
@@ -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" */;
diff --git a/Data4LifeFHIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Data4LifeFHIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 2edb3c7..dc98d12 100644
--- a/Data4LifeFHIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Data4LifeFHIR.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -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"
}
}
]
diff --git a/FhirR4/Sources/FMCore/FHIRParserError.swift b/FhirR4/Sources/FMCore/FHIRParserError.swift
index 95d0cf6..3765e43 100644
--- a/FhirR4/Sources/FMCore/FHIRParserError.swift
+++ b/FhirR4/Sources/FMCore/FHIRParserError.swift
@@ -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
}
diff --git a/FhirR4/Sources/FMCore/Scanner+FHIR.swift b/FhirR4/Sources/FMCore/Scanner+FHIR.swift
index defeb89..523404b 100644
--- a/FhirR4/Sources/FMCore/Scanner+FHIR.swift
+++ b/FhirR4/Sources/FMCore/Scanner+FHIR.swift
@@ -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
diff --git a/FhirR4/Sources/FMCore/TimeZone+FHIR.swift b/FhirR4/Sources/FMCore/TimeZone+FHIR.swift
index 9290968..c96bb4f 100644
--- a/FhirR4/Sources/FMCore/TimeZone+FHIR.swift
+++ b/FhirR4/Sources/FMCore/TimeZone+FHIR.swift
@@ -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
@@ -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))
diff --git a/FhirR4/Sources/ModelsR4/DateTime.swift b/FhirR4/Sources/ModelsR4/DateTime.swift
index 28e559a..6979114 100644
--- a/FhirR4/Sources/ModelsR4/DateTime.swift
+++ b/FhirR4/Sources/ModelsR4/DateTime.swift
@@ -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
@@ -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)
diff --git a/FhirR4/Sources/ModelsR4/FHIRDate.swift b/FhirR4/Sources/ModelsR4/FHIRDate.swift
index d7f088c..5737fae 100644
--- a/FhirR4/Sources/ModelsR4/FHIRDate.swift
+++ b/FhirR4/Sources/ModelsR4/FHIRDate.swift
@@ -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)
diff --git a/FhirR4/Sources/ModelsR4/FHIRTime.swift b/FhirR4/Sources/ModelsR4/FHIRTime.swift
index d863be7..175beb8 100644
--- a/FhirR4/Sources/ModelsR4/FHIRTime.swift
+++ b/FhirR4/Sources/ModelsR4/FHIRTime.swift
@@ -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)
diff --git a/FhirR4/Sources/ModelsR4/Instant.swift b/FhirR4/Sources/ModelsR4/Instant.swift
index 73f1e65..c0382d3 100644
--- a/FhirR4/Sources/ModelsR4/Instant.swift
+++ b/FhirR4/Sources/ModelsR4/Instant.swift
@@ -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)
diff --git a/FhirR4/Sources/ModelsR4/InstantDate.swift b/FhirR4/Sources/ModelsR4/InstantDate.swift
index c84a14a..758bac3 100644
--- a/FhirR4/Sources/ModelsR4/InstantDate.swift
+++ b/FhirR4/Sources/ModelsR4/InstantDate.swift
@@ -69,33 +69,33 @@ public struct InstantDate: FHIRPrimitiveType {
let numbers = CharacterSet.decimalDigits
// Year
- 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))
}
// Month
- guard scanner.scanString("-", into: nil) else {
- throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation))
+ guard scanner.scanString("-") != nil else {
+ throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.currentIndex))
}
- scanLocation = scanner.scanLocation
+ currentIndex = scanner.currentIndex
guard let scannedMonth = scanner.hs_scanCharacters(from: numbers), scannedMonth.count == 2, let month = UInt8(scannedMonth), (1...12).contains(month) else {
- throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
+ throw FHIRDateParserError.invalidMonth(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
// Day
- guard scanner.scanString("-", into: nil) else {
- throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.scanLocation))
+ guard scanner.scanString("-") != nil else {
+ throw FHIRDateParserError.invalidSeparator(FHIRParserErrorPosition(string: scanner.string, location: scanner.currentIndex))
}
- scanLocation = scanner.scanLocation
+ currentIndex = scanner.currentIndex
guard let scannedDay = scanner.hs_scanCharacters(from: numbers), scannedDay.count == 2, let day = UInt8(scannedDay), (1...31).contains(day) else {
- throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: scanLocation))
+ throw FHIRDateParserError.invalidDay(FHIRParserErrorPosition(string: scanner.string, location: currentIndex))
}
// Finish
- 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)
diff --git a/FhirStu3/Sources/Info.plist b/FhirStu3/Sources/Info.plist
index de03598..fcd3639 100644
--- a/FhirStu3/Sources/Info.plist
+++ b/FhirStu3/Sources/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageType
FMWK
CFBundleShortVersionString
- 0.18.1
+ $(MARKETING_VERSION)
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
NSPrincipalClass
diff --git a/FhirStu3/Sources/Primitive/DateAndTime.swift b/FhirStu3/Sources/Primitive/DateAndTime.swift
index 247871f..dd1f619 100644
--- a/FhirStu3/Sources/Primitive/DateAndTime.swift
+++ b/FhirStu3/Sources/Primitive/DateAndTime.swift
@@ -823,12 +823,8 @@ extension Scanner {
public func fhir_scanString(_ searchString: String) -> String? {
#if os(Linux)
return scanString(string: searchString)
- #else
- var str: NSString?
- if scanString(searchString, into: &str) {
- return str as String?
- }
- return nil
+ #else
+ return scanString(searchString)
#endif
}
@@ -836,11 +832,7 @@ extension Scanner {
#if os(Linux)
return scanCharactersFromSet(set)
#else
- var str: NSString?
- if scanCharacters(from: set, into: &str) {
- return str as String?
- }
- return nil
+ return scanCharacters(from: set)
#endif
}