Skip to content

Instantly share code, notes, and snippets.

@somersbmatthews
Last active February 6, 2021 04:38
Show Gist options
  • Save somersbmatthews/fbc27465cb91b3e96b4cffdb9dcabe21 to your computer and use it in GitHub Desktop.
Save somersbmatthews/fbc27465cb91b3e96b4cffdb9dcabe21 to your computer and use it in GitHub Desktop.
function view in swift #swift #ios #swiftui
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