How to use view as parameter ? #136
Answered
by
marcprux
Louis-PAGNIER
asked this question in
Q&A
-
|
In the project that I port with Skip, I often use the Is there an alternative way to write it for Skip ? |
Beta Was this translation helpful? Give feedback.
Answered by
marcprux
May 31, 2024
Replies: 1 comment 3 replies
-
|
We don't support using struct RedBorderView<V: View> : View {
let content: () -> V
var body: some View {
content()
.border(Color.red, width: 5.0)
}
}And then call: RedBorderView {
Text("Hello Red!")
}Hopefully that is sufficient for your needs. If not, please let us know. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
marcprux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

We don't support using
@ViewBuilderas a property of views, but you can use a closure returning a View instead. E.g.:And then call:
Hopefully that is sufficient for your needs. If not, please let us know.