Last active
April 24, 2020 06:49
-
-
Save abadikaka/d8ab17e1835c8ab62ae3f6fa5f34e520 to your computer and use it in GitHub Desktop.
SelectorView Share Kit Tutorial
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
// | |
// SelectorView.swift | |
// SelectorUIViewKitTutorial | |
// | |
// Created by Michael Abadi Santoso on 1/27/20. | |
// Copyright © 2020 Michael Abadi Santoso. All rights reserved. | |
// | |
import SwiftUI | |
public struct BaseView: View { | |
let user: [User] | |
public var body: some View { | |
SelectorView(user: user) | |
} | |
} | |
private struct SelectorView: View { | |
let user: [User] | |
var body: some View { | |
NavigationView { | |
List { | |
ForEach(user, id: \.id) { user in | |
VStack(alignment: .leading) { | |
Text("NAME: \(user.name)") | |
Text("JOB: \(user.job)").padding(.top, 10) | |
} | |
} | |
}.navigationBarTitle("User") | |
} | |
} | |
} | |
struct SelectorView_Previews: PreviewProvider { | |
static var previews: some View { | |
SelectorView(user: [User(id: "test", name: "Michael", job: "Programmer")]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment