Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions Common/Models/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ extension DatedRangeContext: RawRepresentable {
return nil
}

self.startDate = startDate
self.endDate = endDate
self.minValue = minValue
self.maxValue = maxValue
self.init(startDate: startDate, endDate: endDate, minValue: minValue, maxValue: maxValue)
}
}

Expand All @@ -287,7 +284,7 @@ struct StatusExtensionContext: RawRepresentable {
}

if let rawValue = rawValue["glucose"] as? [GlucoseContext.RawValue] {
glucose = rawValue.flatMap({return GlucoseContext(rawValue: $0)})
glucose = rawValue.compactMap({return GlucoseContext(rawValue: $0)})
}

if let rawValue = rawValue["predictedGlucose"] as? PredictedGlucoseContext.RawValue {
Expand All @@ -311,7 +308,7 @@ struct StatusExtensionContext: RawRepresentable {
activeInsulin = rawValue["activeInsulin"] as? Double

if let rawValue = rawValue["targetRanges"] as? [DatedRangeContext.RawValue] {
targetRanges = rawValue.flatMap({return DatedRangeContext(rawValue: $0)})
targetRanges = rawValue.compactMap({return DatedRangeContext(rawValue: $0)})
}

if let rawValue = rawValue["temporaryOverride"] as? DatedRangeContext.RawValue {
Expand Down
2 changes: 1 addition & 1 deletion Common/Models/WatchContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ final class WatchContext: NSObject, RawRepresentable {
}

if let configuredOverrideContextsRawValues = rawValue["coc"] as? [GlucoseRangeScheduleOverrideUserInfo.Context.RawValue] {
configuredOverrideContexts = configuredOverrideContextsRawValues.flatMap(GlucoseRangeScheduleOverrideUserInfo.Context.init(rawValue:))
configuredOverrideContexts = configuredOverrideContextsRawValues.compactMap(GlucoseRangeScheduleOverrideUserInfo.Context.init(rawValue:))
}

IOB = rawValue["iob"] as? Double
Expand Down
6 changes: 5 additions & 1 deletion Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "LoopKit Authors";
TargetAttributes = {
43776F8B1B8022E90074EA36 = {
Expand Down Expand Up @@ -2036,12 +2036,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -2101,12 +2103,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -54,7 +54,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -84,7 +83,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Loop.xcodeproj/xcshareddata/xcschemes/DoseMathTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -10,7 +10,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand All @@ -31,7 +30,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
wasCreatedForAppExtension = "YES"
version = "2.0">
<BuildAction
Expand Down Expand Up @@ -41,7 +41,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -61,7 +60,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
8 changes: 3 additions & 5 deletions Loop.xcodeproj/xcshareddata/xcschemes/Loop.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,9 +26,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -57,7 +56,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Loop.xcodeproj/xcshareddata/xcschemes/LoopTests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -10,7 +10,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand All @@ -31,7 +30,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -54,7 +54,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -84,7 +83,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 1 addition & 3 deletions Loop.xcodeproj/xcshareddata/xcschemes/WatchApp.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0910"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -54,7 +54,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -84,7 +83,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion Loop/Extensions/NSUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ extension UserDefaults {
guard let rawValue = array(forKey: Key.insulinCounteractionEffects.rawValue) as? [GlucoseEffectVelocity.RawValue] else {
return nil
}
return rawValue.flatMap {
return rawValue.compactMap {
GlucoseEffectVelocity(rawValue: $0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Loop/Managers/CGM/CGMManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protocol CGMManagerDelegate: class {


protocol CGMManager: CustomDebugStringConvertible {
weak var delegate: CGMManagerDelegate? { get set }
var delegate: CGMManagerDelegate? { get set }

/// Whether the device is capable of waking the app
var providesBLEHeartbeat: Bool { get }
Expand Down
2 changes: 1 addition & 1 deletion Loop/Managers/CGM/EnliteCGMManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class EnliteCGMManager: CGMManager {

_ = deviceManager.remoteDataManager.nightscoutService.uploader?.processGlucoseEvents(events, source: device.device.deviceURI)

if let latestSensorEvent = events.flatMap({ $0.glucoseEvent as? RelativeTimestampedGlucoseEvent }).last {
if let latestSensorEvent = events.compactMap({ $0.glucoseEvent as? RelativeTimestampedGlucoseEvent }).last {
self.sensorState = EnliteSensorDisplayable(latestSensorEvent)
}

Expand Down
4 changes: 2 additions & 2 deletions Loop/View Controllers/RadioSelectionTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension RadioSelectionTableViewController {
let vc = T()

vc.selectedIndex = value.rawValue
vc.options = (0..<2).flatMap({ InsulinDataSource(rawValue: $0) }).map { String(describing: $0) }
vc.options = (0..<2).compactMap({ InsulinDataSource(rawValue: $0) }).map { String(describing: $0) }
vc.contextHelp = NSLocalizedString("Insulin delivery can be determined from the pump by either interpreting the event history or comparing the reservoir volume over time. Reading event history allows for a more accurate status graph and uploading up-to-date treatment data to Nightscout, at the cost of faster pump battery drain and the possibility of a higher radio error rate compared to reading only reservoir volume. If the selected source cannot be used for any reason, the system will attempt to fall back to the other option.", comment: "Instructions on selecting an insulin data source")

return vc
Expand All @@ -88,7 +88,7 @@ extension RadioSelectionTableViewController {
let vc = T()

vc.selectedIndex = value.rawValue
vc.options = (0..<2).flatMap({ BatteryChemistryType(rawValue: $0) }).map { String(describing: $0) }
vc.options = (0..<2).compactMap({ BatteryChemistryType(rawValue: $0) }).map { String(describing: $0) }
vc.contextHelp = NSLocalizedString("Alkaline and Lithium batteries decay at differing rates. Alkaline tend to have a linear voltage drop over time whereas lithium cell batteries tend to maintain voltage until halfway through their lifespan. Under normal usage in a Non-MySentry compatible Minimed (x22/x15) insulin pump running Loop, Alkaline batteries last approximately 4 to 5 days. Lithium batteries last between 1-2 weeks. This selection will use different battery voltage decay rates for each of the battery chemistry types and alert the user when a battery is approximately 8 to 10 hours from failure.", comment: "Instructions on selecting battery chemistry type")

return vc
Expand Down
12 changes: 6 additions & 6 deletions LoopUI/Managers/StatusChartsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public final class StatusChartsManager {
frame: frame,
innerFrame: innerFrame,
settings: chartSettings,
layers: layers.flatMap { $0 }
layers: layers.compactMap { $0 }
)
}

Expand Down Expand Up @@ -487,7 +487,7 @@ public final class StatusChartsManager {
iobLine,
]

return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.flatMap { $0 })
return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.compactMap { $0 })
}

public func cobChartWithFrame(_ frame: CGRect) -> Chart? {
Expand Down Expand Up @@ -544,7 +544,7 @@ public final class StatusChartsManager {
cobLine
]

return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.flatMap { $0 })
return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.compactMap { $0 })
}

public func doseChartWithFrame(_ frame: CGRect) -> Chart? {
Expand Down Expand Up @@ -632,7 +632,7 @@ public final class StatusChartsManager {
bolusLayer
]

return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.flatMap { $0 })
return Chart(frame: frame, innerFrame: innerFrame, settings: chartSettings, layers: layers.compactMap { $0 })
}

// MARK: - Carb Effect
Expand Down Expand Up @@ -765,7 +765,7 @@ public final class StatusChartsManager {
frame: frame,
innerFrame: innerFrame,
settings: chartSettings,
layers: layers.flatMap { $0 }
layers: layers.compactMap { $0 }
)
}

Expand Down Expand Up @@ -893,7 +893,7 @@ public final class StatusChartsManager {
frame: frame,
innerFrame: coordsSpace.chartInnerFrame,
settings: chartSettings,
layers: layers.flatMap { $0 }
layers: layers.compactMap { $0 }
)
}

Expand Down
2 changes: 1 addition & 1 deletion LoopUI/Views/ChartPointsContextFillLayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class ChartPointsFillsLayer: ChartCoordsSpaceLayer {
let fills: [ChartPointsFill]

init?(xAxis: ChartAxis, yAxis: ChartAxis, fills: [ChartPointsFill?]) {
self.fills = fills.flatMap({ $0 })
self.fills = fills.compactMap({ $0 })

guard fills.count > 0 else {
return nil
Expand Down