NEW: Join my free 100 Days of SwiftUI challenge today! >>

Working with lists

Paul Hudson    @twostraws   

Fully updated for Xcode 11 GM

SwiftUI’s List view is similar to UITableView in that it can show static or dynamic table view cells based on your needs. However, it is significantly simpler to use: we don’t need to create prototype cells in storyboards, or register them in code; we don’t need to tell it how many rows there are; we don’t need to dequeue and configure cells by hand, and more.

Instead, SwiftUI’s lists are designed for composability – designed to be able to build bigger things from smaller things. So rather than having one large view controller that configures cells by hand, SwiftUI has us build small views that know how to configure themselves as list rows, then use those.

In terms of code size if nothing else, the difference is staggering – you can delete almost all your table view code and still get the same great look and feel you’re used to.

LEARN SWIFTUI FOR FREE I have a massive, free SwiftUI video collection on YouTube teaching you how to build complete apps with SwiftUI – check it out!

Similar solutions…

MASTER SWIFT NOW
Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 2.8/5