Conclusion

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

In this lesson, you learned about building complex views in SwiftUI. First, you learned how to use a ViewBuilder to pass views into another view when doing iterations. You also saw how generics let your views work without hard coding specific types. Finally, you saw how using a KeyPath provides a way to reference an object property without invoking the property.

Now, you can:

  • Leverage SwiftUI’s principle of modular design to build a complex view from smaller, simpler ones.
  • Use ViewBuilder to create a reusable view.
  • Use generics and key paths to encapsulate a view for reuse anywhere.

For more on key paths, see the Key-Path Expression section of the Swift Programming Language Manual’s Expressions chapter. For more about generics in Swift, see Swift Generics Tutorial: Getting Started.

See forum comments
Download course materials from Github
Previous: Making the Timeline Generic Next: Quiz: Implementing Complex UI Layouts