Skip to content

Instantly share code, notes, and snippets.

@abadikaka
Last active April 24, 2020 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abadikaka/d8ab17e1835c8ab62ae3f6fa5f34e520 to your computer and use it in GitHub Desktop.
Save abadikaka/d8ab17e1835c8ab62ae3f6fa5f34e520 to your computer and use it in GitHub Desktop.
SelectorView Share Kit Tutorial
//
// 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