Skip to content

Commit 85e4c4e

Browse files
committed
Add VariableBlurEffect
1 parent 9ebe77e commit 85e4c4e

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// VariableBlurEffect.swift
3+
// OpenSwiftUICore
4+
//
5+
// Audited for 6.5.4
6+
// Status: Blocked by Image resolving
7+
// ID: 6A2330B0C22A93F083499CFD6C3BD5B1 (SwiftUICore)
8+
9+
public import Foundation
10+
11+
// MARK: - VariableBlurEffect
12+
13+
private struct VariableBlurEffect: EnvironmentalModifier, Equatable {
14+
var radius: CGFloat
15+
var mask: Image
16+
var isOpaque: Bool
17+
18+
typealias ResolvedModifier = VariableBlurStyle
19+
20+
func resolve(in environment: EnvironmentValues) -> VariableBlurStyle {
21+
// TODO: Image resolving
22+
return VariableBlurStyle(
23+
radius: radius,
24+
isOpaque: isOpaque,
25+
mask: .none
26+
)
27+
}
28+
}
29+
30+
@_spi(Private)
31+
@available(OpenSwiftUI_v5_0, *)
32+
extension View {
33+
nonisolated public func variableBlur(maxRadius: CGFloat, mask: Image, opaque: Bool = false) -> some View {
34+
modifier(VariableBlurEffect(radius: maxRadius, mask: mask, isOpaque: opaque))
35+
}
36+
}

0 commit comments

Comments
 (0)