|
@@ -8,24 +8,25 @@ import SwiftUI
|
|
/// Creates a blur effect.
|
|
/// Creates a blur effect.
|
|
public struct BlurEffectModifier: ViewModifier {
|
|
public struct BlurEffectModifier: ViewModifier {
|
|
public init() {}
|
|
public init() {}
|
|
-
|
|
|
|
|
|
+
|
|
public func body(content: Content) -> some View {
|
|
public func body(content: Content) -> some View {
|
|
content.overlay(_BlurVisualEffectViewRepresentable())
|
|
content.overlay(_BlurVisualEffectViewRepresentable())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-fileprivate struct _BlurVisualEffectViewRepresentable: UIViewRepresentable {
|
|
|
|
- func makeUIView(context: Context) -> UIVisualEffectView {
|
|
|
|
- UIVisualEffectView(effect: UIBlurEffect(style: context.environment.blurEffectStyle))
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- func updateUIView(_ uiView: UIVisualEffectView, context: Context) {}
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
|
|
+/// Creates a blur effect.
|
|
public struct BlurEffect: View {
|
|
public struct BlurEffect: View {
|
|
public init() {}
|
|
public init() {}
|
|
-
|
|
|
|
|
|
+
|
|
public var body: some View {
|
|
public var body: some View {
|
|
_BlurVisualEffectViewRepresentable()
|
|
_BlurVisualEffectViewRepresentable()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+fileprivate struct _BlurVisualEffectViewRepresentable: UIViewRepresentable {
|
|
|
|
+ func makeUIView(context: Context) -> UIVisualEffectView {
|
|
|
|
+ UIVisualEffectView(effect: UIBlurEffect(style: context.environment.blurEffectStyle))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func updateUIView(_ uiView: UIVisualEffectView, context: Context) {}
|
|
|
|
+}
|