Skip to content

Instantly share code, notes, and snippets.

@DineshKachhot
Created March 5, 2020 05:53
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 DineshKachhot/b114d335e867b39b378d5cccd0358d53 to your computer and use it in GitHub Desktop.
Save DineshKachhot/b114d335e867b39b378d5cccd0358d53 to your computer and use it in GitHub Desktop.
//
// FormViewSocial.swift
// SwiftUI_Practice
//
// Created by Dinesh Kachhot on 05/03/20.
// Copyright © 2020 KD. All rights reserved.
//
import SwiftUI
struct FormViewSocial: View {
@State private var firstNameText: String = ""
@State private var lastNameText: String = ""
@State private var companyText: String = ""
@State private var mobileText: String = ""
var body: some View {
NavigationView() {
Form {
Section(header: ContactHeader()) {
TextField("First Name", text: $firstNameText)
TextField("Last Name", text: $lastNameText)
TextField("Company", text: $lastNameText)
}
Section {
HStack {
Image(systemName: "minus.circle.fill").foregroundColor(.red)
Text("mobile").font(.body)
Image(systemName: "chevron.right").foregroundColor(.gray)
TextField("Mobile", text: $mobileText)
}
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add phone").font(.body)
}
}
.font(.callout)
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add email").font(.body)
}
}
.font(.callout)
Section {
HStack {
Text("Rington").font(.body)
Text("Default").font(.headline)
}
}
Section {
HStack {
Text("Text Ton").font(.body)
Text("Default").font(.headline)
}
}
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add address").font(.body)
}
}
.font(.callout)
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add birthday").font(.body)
}
}
.font(.callout)
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add date").font(.body)
}
}
.font(.callout)
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add related name").font(.body)
}
}
.font(.callout)
Section {
HStack {
Image(systemName: "plus.circle.fill").foregroundColor(.green)
Text("add social profile").font(.body)
}
}
.font(.callout)
}
.navigationBarTitle("New Contact", displayMode: .inline)
.navigationBarItems(leading: Button("Cancel"){}, trailing: Button("Done"){})
}
}
}
struct ContactHeader: View {
var body: some View {
HStack {
Spacer()
VStack(alignment: .center, spacing: 10) {
// Spacer()
Image(systemName: "person.circle.fill").resizable().frame(width: 150, height: 150, alignment: .center)
Button("Add Photo") {}
Spacer()
}
Spacer()
}
}
}
struct FormViewSocial_Previews: PreviewProvider {
static var previews: some View {
FormViewSocial().environment(\.colorScheme, .dark)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment