Advertisement
Guest User

Untitled

a guest
Jul 6th, 2022
1,890
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.25 KB | None
  1. extension View {
  2.     func `if`<Content: View>(_ conditional: Bool, content: (Self) -> Content) -> some View {
  3.         if conditional {
  4.             return AnyView(content(self))
  5.         }
  6.         else {
  7.             return AnyView(self)
  8.         }
  9.     }
  10. }
Advertisement
RAW Paste Data Copied
Advertisement