Last active
February 6, 2021 04:38
-
-
Save somersbmatthews/fbc27465cb91b3e96b4cffdb9dcabe21 to your computer and use it in GitHub Desktop.
function view in swift #swift #ios #swiftui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
struct PeopleView: View { | |
@ObservedObject var viewModel = PeopleModel() | |
var body: some View { | |
VStack { | |
ScrollView { | |
ForEach(viewModel.people) { person in | |
VStack(alignment: .leading) { | |
Text(person.name) | |
Text(person.twitterHandle | |
} | |
} | |
} | |
footerView | |
} | |
} | |
private var footerView: some View { | |
Text("footer view") | |
.padding() | |
} | |
private func row(forPerson person: PeopleModel.Person -> some View { | |
HStack { | |
VStack(alignment: .leading) { | |
Text(person.name) | |
Text(person.twitterHandle) | |
} | |
Spacer() | |
} | |
.padding() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment