Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct UserView: View {
- let user: User
- var body: some View {
- List{
- Section(header: Text("Name")){
- Text(user.name)
- }
- Section(header: Text("Age")){
- Text("\(user.age)")
- }
- Section(header: Text("Company")){
- Text("\(user.company)")
- }
- Section(header: Text("E-mail")){
- Text("\(user.email)")
- }
- Section(header: Text("Address")){
- Text("\(user.address)")
- }
- Section(header: Text("Friends")){
- ForEach(user.friends) { friend in
- Text(friend.name)
- }
- }
- }
- .listStyle(.grouped)
- }
- }
- struct UserView_Previews: PreviewProvider {
- static var previews: some View {
- UserView(user: User.example)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment