support for stored properties
struct CardView<Content: View>: View {
  // 👇🏻 New in Swift 5.4
  @ViewBuilder let content: Content
  
  // ⭐️ Swift will synthesize the following (internal) initializer:
  // ```
  // internal init(@ViewBuilder content: () -> Content) {
  //   self.content = content()
  // }
  // ```
  var body: some View {
    content
  }
}- Five Stars ⟩ SwiftUI patterns: passing & accepting views - ViewBuilder support for stored properties. 
Last updated
Was this helpful?