another.im-ios/Monal/another.im/Helpers/View+If.swift

12 lines
270 B
Swift
Raw Normal View History

2024-11-19 16:07:47 +00:00
import SwiftUI
public extension View {
@ViewBuilder func `if`<Content: View>(_ condition: @autoclosure () -> Bool, transform: (Self) -> Content) -> some View {
if condition() {
transform(self)
} else {
self
}
}
}