Composing views to create a list row - a free SwiftUI by Example tutorial
Just having names of menu items written out isn’t particularly appealing for a restaurant, so let’s make those items look good. First, though, an important lesson: SwiftUI is designed to be composable, which means you can make views out of any other views you like. We have a simple text view for our items right now, Text(item.name), but we’re going to add much more in there to bring it to life. While we could put that directly into ContentView.swift, it becomes long and hard to read. A better idea is to make a new view type that we can embed inside ContentView, and SwiftUI is designed to make this both easy (it takes only 30 seconds to learn) and extremely fast (it has almost zero performance impact). So, press Cmd+N to create a new file, choose SwiftUI View under the User Interface category, then call it “ItemRow”. You’ll see Xcode has generated a new view with some sample code to get us started: We’re going to be doing something new in just a moment, but first I want to get us to the
Composing views to create a list row - a free SwiftUI by Example tutorial WWDC26: Save 50% on my books and bundles! >> < Building a menu using List Polishing designs with fonts and colors > Composing views to create a list row Paul Hudson @twostraws April 30th 2024 Updated for Xcode 16.4 Just having names of menu items written out isn’t particularly appealing for a restaurant, so let’s make those items look good. First, though, an important lesson: SwiftUI is designed to be composable , which means you can make views out of any other views you like. We have a simple text view for our items rig
Explore this link on the map →related reading
- Building a menu using List - a free SwiftUI by Example tutorialhackingwithswift.com
- SwiftUI by Example - free quick start tutorials for Swift developershackingwithswift.com
- Polishing designs with fonts and colors - a free SwiftUI by Example tutorialhackingwithswift.com
- Using stacks to arrange views | Apple Developer Documentationdeveloper.apple.com
- Displaying a detail screen with NavigationLink - a free SwiftUI by Example tutorialhackingwithswift.com
- A Day in the Life of a SwiftUI View — Chris Eidhofchris.eidhof.nl
- What’s in the basic template? - a free SwiftUI by Example tutorialhackingwithswift.com
- Laying out a simple view | Apple Developer Documentationdeveloper.apple.com
- AnyView | Apple Developer Documentationdeveloper.apple.com
- What is SwiftUI? - a free SwiftUI by Example tutorialhackingwithswift.com
- Structural identity in SwiftUI | Swift with Majidswiftwithmajid.com
- Embark: Dynamic documents for making plansinkandswitch.com