IceCubesApp/Packages/DesignSystem/Sources/DesignSystem/ConditionalModifier.swift

12 lines
221 B
Swift
Raw Normal View History

2024-01-23 07:51:58 +00:00
import SwiftUI
public extension View {
2024-02-14 11:48:14 +00:00
@ViewBuilder func `if`<Content: View>(_ condition: Bool, transform: (Self) -> Content) -> some View {
if condition {
transform(self)
} else {
self
2024-01-23 07:51:58 +00:00
}
2024-02-14 11:48:14 +00:00
}
2024-01-23 07:51:58 +00:00
}