summaryrefslogtreecommitdiff
path: root/Jel/Models
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2024-01-09 12:32:06 -0500
committerShav Kinderlehrer <[email protected]>2024-01-09 12:32:06 -0500
commit6edc39791a577a500c92f32361cf1e7d2590ec37 (patch)
tree776de4bae461836f8cba5ff673fc4ccfabd6df55 /Jel/Models
parent4ec0f962b2a175ae5f1e3e55a720f9534618a4ad (diff)
downloadjel-6edc39791a577a500c92f32361cf1e7d2590ec37.tar.gz
jel-6edc39791a577a500c92f32361cf1e7d2590ec37.zip
Implement ItemPeopleView
Diffstat (limited to 'Jel/Models')
-rw-r--r--Jel/Models/ViewExtensions.swift (renamed from Jel/Models/ViewConditionalMethod.swift)18
1 files changed, 13 insertions, 5 deletions
diff --git a/Jel/Models/ViewConditionalMethod.swift b/Jel/Models/ViewExtensions.swift
index 195a8dc..7f54865 100644
--- a/Jel/Models/ViewConditionalMethod.swift
+++ b/Jel/Models/ViewExtensions.swift
@@ -1,5 +1,5 @@
//
-// ViewConditionalMethod.swift
+// ViewExtensions.swift
// Jel
//
// Created by zerocool on 12/25/23.
@@ -9,10 +9,6 @@ import SwiftUI
extension View {
/// Applies the given transform if the given condition evaluates to `true`.
- /// - Parameters:
- /// - condition: The condition to evaluate.
- /// - transform: The transform to apply to the source `View`.
- /// - Returns: Either the original `View` or the modified `View` if the condition is `true`.
@ViewBuilder func `if`<Content: View>(_ condition: @autoclosure () -> Bool, transform: (Self) -> Content) -> some View {
if condition() {
transform(self)
@@ -21,3 +17,15 @@ extension View {
}
}
}
+
+extension View {
+ /// Applies an inverse mask to the given view
+ public func inverseMask<Content: View>(_ mask: Content) -> some View {
+ let inverseMask = mask
+ .foregroundStyle(.black)
+ .background(.white)
+ .compositingGroup()
+ .luminanceToAlpha()
+ return self.mask(inverseMask)
+ }
+}