Skip to content

Commit c75c8c8

Browse files
committed
Update widgets for build with Xcode 15
1 parent 55cf35a commit c75c8c8

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// ContentMargin.swift
3+
// Loop Widget Extension
4+
//
5+
// Created by Cameron Ingham on 9/29/23.
6+
// Copyright © 2023 LoopKit Authors. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
import WidgetKit
11+
12+
extension WidgetConfiguration {
13+
func contentMarginsDisabledIfAvailable() -> some WidgetConfiguration {
14+
if #available(iOSApplicationExtension 17.0, *) {
15+
return self.contentMarginsDisabled()
16+
} else {
17+
return self
18+
}
19+
}
20+
}

Loop Widget Extension/Helpers/WidgetBackground.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import SwiftUI
1111
extension View {
1212
@ViewBuilder
1313
func widgetBackground() -> some View {
14-
self.background { Color("WidgetBackground") }
14+
if #available(iOSApplicationExtension 17.0, *) {
15+
self.containerBackground(for: .widget) {
16+
Color("WidgetBackground")
17+
}
18+
} else {
19+
self.background { Color("WidgetBackground") }
20+
}
1521
}
1622
}

Loop Widget Extension/Widgets/SystemStatusWidget.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ struct SystemStatusWidget: Widget {
7676
.configurationDisplayName("Loop Status Widget")
7777
.description("See your current blood glucose and insulin delivery.")
7878
.supportedFamilies([.systemSmall, .systemMedium])
79+
.contentMarginsDisabledIfAvailable()
7980
}
8081
}

Loop.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
84AA81E32A4A36FB000B658B /* SystemActionLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AA81E22A4A36FB000B658B /* SystemActionLink.swift */; };
254254
84AA81E52A4A3981000B658B /* DeeplinkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AA81E42A4A3981000B658B /* DeeplinkManager.swift */; };
255255
84AA81E72A4A4DEF000B658B /* PumpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AA81E62A4A4DEF000B658B /* PumpView.swift */; };
256+
84D2879F2AC756C8007ED283 /* ContentMargin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84D2879E2AC756C8007ED283 /* ContentMargin.swift */; };
256257
891B508524342BE1005DA578 /* CarbAndBolusFlowViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 891B508424342BE1005DA578 /* CarbAndBolusFlowViewModel.swift */; };
257258
892A5D59222F0A27008961AB /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892A5D58222F0A27008961AB /* Debug.swift */; };
258259
892A5D692230C41D008961AB /* RangeReplaceableCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892A5D682230C41D008961AB /* RangeReplaceableCollection.swift */; };
@@ -1182,6 +1183,7 @@
11821183
84AA81E22A4A36FB000B658B /* SystemActionLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemActionLink.swift; sourceTree = "<group>"; };
11831184
84AA81E42A4A3981000B658B /* DeeplinkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeeplinkManager.swift; sourceTree = "<group>"; };
11841185
84AA81E62A4A4DEF000B658B /* PumpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PumpView.swift; sourceTree = "<group>"; };
1186+
84D2879E2AC756C8007ED283 /* ContentMargin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentMargin.swift; sourceTree = "<group>"; };
11851187
891B508424342BE1005DA578 /* CarbAndBolusFlowViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarbAndBolusFlowViewModel.swift; sourceTree = "<group>"; };
11861188
892A5D29222EF60A008961AB /* MockKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = MockKit.framework; path = Carthage/Build/iOS/MockKit.framework; sourceTree = SOURCE_ROOT; };
11871189
892A5D2B222EF60A008961AB /* MockKitUI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = MockKitUI.framework; path = Carthage/Build/iOS/MockKitUI.framework; sourceTree = SOURCE_ROOT; };
@@ -2532,6 +2534,7 @@
25322534
children = (
25332535
84AA81DA2A4A2973000B658B /* Date.swift */,
25342536
84AA81D52A4A28AF000B658B /* WidgetBackground.swift */,
2537+
84D2879E2AC756C8007ED283 /* ContentMargin.swift */,
25352538
);
25362539
path = Helpers;
25372540
sourceTree = "<group>";
@@ -3640,6 +3643,7 @@
36403643
14B1737328AEDBF6006CCD7C /* SystemStatusWidget.swift in Sources */,
36413644
84AA81DD2A4A2999000B658B /* StatusWidgetTimelineProvider.swift in Sources */,
36423645
14B1737528AEDBF6006CCD7C /* LoopCircleView.swift in Sources */,
3646+
84D2879F2AC756C8007ED283 /* ContentMargin.swift in Sources */,
36433647
);
36443648
runOnlyForDeploymentPostprocessing = 0;
36453649
};

0 commit comments

Comments
 (0)