Advertisement
Guest User

Untitled

a guest
Jul 6th, 2022
2,471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.25 KB | None | 0 0
  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
Add Comment
Please, Sign In to add comment
Advertisement