Skip to content

Commit eef6b64

Browse files
committed
Added conditions.
1 parent 32acaaa commit eef6b64

File tree

8 files changed

+17
-5
lines changed

8 files changed

+17
-5
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let package = Package(
66
name: "SwiftUIExtension",
77
platforms: [
88
.iOS(.v15),
9-
.watchOS(.v6),
9+
.watchOS(.v8),
1010
.macOS(.v10_15)
1111
],
1212
products: [

Sources/SwiftUIExtension/Compability/TransitionBlurReplace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ extension View {
1010
struct TransitionBlurReplace: ViewModifier {
1111

1212
func body(content: Content) -> some View {
13-
if #available(iOS 18.0, *) {
13+
if #available(iOS 18.0, watchOS 10.0, *) {
1414
content
1515
.transition(.blurReplace.combined(with: .opacity))
1616
} else {

Sources/SwiftUIExtension/Extensions/SafeArea.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ extension View {
1515

1616
// MARK: - Environment
1717

18+
#if os(iOS)
1819
extension EnvironmentValues {
1920

2021
public var safeAreaInsets: EdgeInsets {
@@ -25,7 +26,8 @@ extension EnvironmentValues {
2526
private struct SafeAreaInsetsKey: EnvironmentKey {
2627

2728
static var defaultValue: EdgeInsets {
28-
(UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.safeAreaInsets ?? .zero).insets
29+
(UIApplication.shared.rootController?.view.window?.safeAreaInsets ?? .zero).insets
30+
//(UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.safeAreaInsets ?? .zero).insets
2931
}
3032
}
3133

@@ -35,3 +37,4 @@ private extension UIEdgeInsets {
3537
EdgeInsets(top: top, leading: left, bottom: bottom, trailing: right)
3638
}
3739
}
40+
#endif

Sources/SwiftUIExtension/Views/CustomBlurView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if canImport(SwiftUI) && canImport(UIKit) && os(iOS)
12
import UIKit
23
import SwiftUI
34

@@ -207,3 +208,4 @@ private extension UIVisualEffect {
207208
}
208209
}
209210
}
211+
#endif

Sources/SwiftUIExtension/Views/Mimicrate/ModalSheet/ModalSheet.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS)
12
import SwiftUI
23

34
extension View {
@@ -21,4 +22,4 @@ extension View {
2122
return self.modifier(sheet)
2223
}
2324
}
24-
25+
#endif

Sources/SwiftUIExtension/Views/Mimicrate/ModalSheet/ModalSheetModifier.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if os(iOS)
12
import SwiftUI
23
import SwiftBoost
34

@@ -129,3 +130,4 @@ struct ModalSheetModifier<ModalContent: View, Selection: Hashable>: ViewModifier
129130
private var cornerRadius: CGFloat { UIScreen.main.displayCornerRadius - padding }
130131
private var presentDimissDuration: TimeInterval { 0.41 }
131132
}
133+
#endif

Sources/SwiftUIExtension/Views/Mimicrate/NativeSection.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public struct NativeSection<Content: View, Detail: View>: View {
8989
return Spaces.default_less
9090
#elseif os(visionOS)
9191
return Spaces.step
92+
#else
93+
return 0
9294
#endif
9395
}
9496
}

Sources/SwiftUIExtension/Views/Mimicrate/NavigationBarCloseButton.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
#if canImport(SwiftUI) && canImport(UIKit) && os(iOS)
12
import SwiftUI
3+
import UIKit
24

35
public struct NavigationBarCloseButton: UIViewRepresentable {
46

@@ -41,4 +43,4 @@ public struct NavigationBarCloseButton: UIViewRepresentable {
4143
}
4244
}
4345
}
44-
46+
#endif

0 commit comments

Comments
 (0)