Created
Sep 19, 2019 12:03 PM
Tags
SwiftUI.framework
Keywords
React has HOC(higher-order components.)
What is HOC?
In SwiftUI, we can do this just like,
But, I'm thinking can I use upper-camel-case in this naming.
// Higher order component
// https://reactjs.org/docs/higher-order-components.html
// Can I use UpperCamelCase? or not?
func MyComponent(title: String, detail: String) -> some View {
VStack {
Text(title)
Text(detail)
}
}
// Usage
VStack {
MyComponent(title: "Hello", detail: "SwiftUI")
}