Mercurial > public > lazybear
comparison LazyBear/Helpers/ConditionallyWrapView.swift @ 465:6953d83060a4
New design
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 17 Jul 2021 17:58:57 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
464:04e430ef254a | 465:6953d83060a4 |
---|---|
1 // | |
2 // ConditionallyWrapView.swift | |
3 // lazybear | |
4 // | |
5 // Created by Dennis Concepción Martín on 17/07/2021. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 extension View { | |
11 @ViewBuilder | |
12 func `if`<Content: View>(_ conditional: Bool, content: (Self) -> Content) -> some View { | |
13 if conditional { | |
14 content(self) | |
15 } else { | |
16 self | |
17 } | |
18 } | |
19 } |