Skip to content

Commit 6b1b5d3

Browse files
committed
Added widgetContentMarginsCompability.
1 parent eec32c3 commit 6b1b5d3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Sources/SwiftUIExtension/Compability/WidgetViewCompability.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import SwiftUI
33
#if canImport(WidgetKit)
44
import WidgetKit
55

6+
extension EnvironmentValues {
7+
8+
public var widgetContentMarginsCompability: EdgeInsets {
9+
get {
10+
if #available(iOS 17.0, *) {
11+
return self.widgetContentMargins
12+
} else {
13+
return .init(top: 16, leading: 16, bottom: 16, trailing: 16)
14+
}
15+
}
16+
}
17+
}
18+
619
extension View {
720

821
public func containerBackgroundForWidgetCompability<Background>(background: @escaping () -> Background) -> some View where Background: View {

0 commit comments

Comments
 (0)