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

12 lines
270 B
Swift
Raw Normal View History

2024-07-04 15:01:30 +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
}
}
}