Skip to content

Commit

Permalink
Added conditions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanvorobei committed Nov 24, 2024
1 parent 32acaaa commit eef6b64
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let package = Package(
name: "SwiftUIExtension",
platforms: [
.iOS(.v15),
.watchOS(.v6),
.watchOS(.v8),
.macOS(.v10_15)
],
products: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extension View {
struct TransitionBlurReplace: ViewModifier {

func body(content: Content) -> some View {
if #available(iOS 18.0, *) {
if #available(iOS 18.0, watchOS 10.0, *) {
content
.transition(.blurReplace.combined(with: .opacity))
} else {
Expand Down
5 changes: 4 additions & 1 deletion Sources/SwiftUIExtension/Extensions/SafeArea.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extension View {

// MARK: - Environment

#if os(iOS)
extension EnvironmentValues {

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

static var defaultValue: EdgeInsets {
(UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.safeAreaInsets ?? .zero).insets
(UIApplication.shared.rootController?.view.window?.safeAreaInsets ?? .zero).insets
//(UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.safeAreaInsets ?? .zero).insets
}
}

Expand All @@ -35,3 +37,4 @@ private extension UIEdgeInsets {
EdgeInsets(top: top, leading: left, bottom: bottom, trailing: right)
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/SwiftUIExtension/Views/CustomBlurView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if canImport(SwiftUI) && canImport(UIKit) && os(iOS)
import UIKit
import SwiftUI

Expand Down Expand Up @@ -207,3 +208,4 @@ private extension UIVisualEffect {
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(iOS)
import SwiftUI

extension View {
Expand All @@ -21,4 +22,4 @@ extension View {
return self.modifier(sheet)
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if os(iOS)
import SwiftUI
import SwiftBoost

Expand Down Expand Up @@ -129,3 +130,4 @@ struct ModalSheetModifier<ModalContent: View, Selection: Hashable>: ViewModifier
private var cornerRadius: CGFloat { UIScreen.main.displayCornerRadius - padding }
private var presentDimissDuration: TimeInterval { 0.41 }
}
#endif
2 changes: 2 additions & 0 deletions Sources/SwiftUIExtension/Views/Mimicrate/NativeSection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public struct NativeSection<Content: View, Detail: View>: View {
return Spaces.default_less
#elseif os(visionOS)
return Spaces.step
#else
return 0
#endif
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#if canImport(SwiftUI) && canImport(UIKit) && os(iOS)
import SwiftUI
import UIKit

public struct NavigationBarCloseButton: UIViewRepresentable {

Expand Down Expand Up @@ -41,4 +43,4 @@ public struct NavigationBarCloseButton: UIViewRepresentable {
}
}
}

#endif

0 comments on commit eef6b64

Please sign in to comment.