-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
245 additions
and
24 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
SwiftUIPractice/SwiftUIPractice/Assets.xcassets/Nature2.imageset/Contents.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Nature2.jpeg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+12.5 KB
SwiftUIPractice/SwiftUIPractice/Assets.xcassets/Nature2.imageset/Nature2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
SwiftUIPractice/SwiftUIPractice/Assets.xcassets/ferrari.imageset/Contents.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ferrari.jpg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+136 KB
SwiftUIPractice/SwiftUIPractice/Assets.xcassets/ferrari.imageset/ferrari.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// LoginScreenView.swift | ||
// SwiftUIPractice | ||
// | ||
// Created by Bhole, Kaustubh Satish on 31/07/20. | ||
// Copyright © 2020 Bhole, Kaustubh Satish. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LoginScreenView: View { | ||
@State var email = "" | ||
@State var password = "" | ||
@State var loginBittonClick: Int? = nil | ||
|
||
var body: some View { | ||
|
||
NavigationView { | ||
VStack(alignment: .leading) { | ||
Text("Let's Login.") | ||
.bold() | ||
.font(.system(size: 40)) | ||
.multilineTextAlignment(.leading) | ||
.frame(width: 300, height: 100, alignment: .topLeading) | ||
.padding(Edge.Set.bottom, 50) | ||
|
||
Text("Email address:") | ||
.font(.headline) | ||
TextField("Email", text: $email) | ||
.frame(height:44) | ||
.accentColor(Color.white) | ||
.background(Color(UIColor.lightGray)) | ||
.cornerRadius(4.0) | ||
|
||
Text("Password:") | ||
.font(.headline) | ||
|
||
SecureField("Password", text: $password) | ||
.frame(height:44) | ||
.accentColor(Color.white) | ||
.background(Color(UIColor.lightGray)) | ||
.cornerRadius(4.0) | ||
HStack { | ||
Spacer() | ||
Button(action: { | ||
print("Forgot password tapped") | ||
}) { | ||
Text("Forgot Password?").foregroundColor(Color.gray).bold() | ||
} | ||
.accentColor(Color.black) | ||
.padding(Edge.Set.vertical, 5) | ||
} | ||
Spacer() | ||
NavigationLink(destination: SegmentedControlView(), tag: 1, selection: $loginBittonClick) { | ||
Button(action: { | ||
self.loginBittonClick = 1 | ||
}) { | ||
HStack { | ||
Spacer() | ||
Text("Login").foregroundColor(Color.white).bold() | ||
Spacer() | ||
} | ||
} | ||
.accentColor(Color.black) | ||
.padding() | ||
.background(Color(UIColor.red)) | ||
.cornerRadius(20.0) | ||
.padding(Edge.Set.vertical, 20) | ||
} | ||
Spacer() | ||
} | ||
.padding(.horizontal,30) | ||
} | ||
.navigationBarTitle(Text("Login")) | ||
} | ||
} | ||
|
||
struct LoginScreenView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LoginScreenView() | ||
} | ||
} |
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
106 changes: 106 additions & 0 deletions
106
SwiftUIPractice/SwiftUIPractice/SegmentedControlView.swift
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// | ||
// SegmentedControlView.swift | ||
// SwiftUIPractice | ||
// | ||
// Created by Bhole, Kaustubh Satish on 19/07/20. | ||
// Copyright © 2020 Bhole, Kaustubh Satish. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct SegmentedControlView: View { | ||
@State private var selectedIndex = 0 | ||
private let segmentItems = ["Nature","Birds","Cars"] | ||
private let images = ["Nature2","bird1","ferrari"] | ||
|
||
var body: some View { | ||
VStack { | ||
Picker("", selection: $selectedIndex) { | ||
ForEach(0 ..< segmentItems.count) { | ||
Text(self.segmentItems[$0]) | ||
} | ||
}.pickerStyle(SegmentedPickerStyle()) | ||
.padding(.all, 20) | ||
.onReceive([self.selectedIndex].publisher.first()) { index in | ||
switch index { | ||
case 0: | ||
print("First Tab selected") | ||
case 1: | ||
print("Second Tab selected") | ||
default: | ||
break | ||
} | ||
} | ||
List { | ||
ForEach (0...4, id: \.self) { contact in | ||
NavigationLink(destination: Image(self.images[self.selectedIndex])) { | ||
CellRow(selectedIndex: self.selectedIndex) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct CellRow: View { | ||
var selectedIndex = 0 | ||
|
||
var body: some View { | ||
containViews() | ||
} | ||
|
||
func containViews() -> AnyView { | ||
switch self.selectedIndex { | ||
case 0: | ||
return AnyView(ListRow(text: "Colors are the smiles of Nature", image: "Nature2")) | ||
case 1: | ||
return AnyView(ListRow(text: "A bird who dares to fall is the bird who learn to fly", image: "bird1")) | ||
case 2: | ||
return AnyView(ListRow(text: "No road is long with Good Company", image: "ferrari")) | ||
default: | ||
return AnyView(ListRow(text: "cars are just Awesome", image: "ferrari")) | ||
} | ||
} | ||
} | ||
|
||
struct ListRow: View { | ||
var text: String | ||
var image: String | ||
|
||
var body: some View { | ||
HStack { | ||
VStack(alignment: .leading, spacing: 5) { | ||
Text(text) | ||
} | ||
Image(image) | ||
.resizable() | ||
.scaledToFit() | ||
.frame(height: 160, alignment: .center) | ||
}.background(Color(.lightGray)) | ||
|
||
} | ||
} | ||
|
||
struct Car: View { | ||
var body: some View { | ||
Image("ferrari") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(height: 160, alignment: .center) | ||
} | ||
} | ||
|
||
struct Nature: View { | ||
var body: some View { | ||
Image("Nature2") | ||
.resizable() | ||
.scaledToFit() | ||
.frame(height: 160, alignment: .center) | ||
} | ||
} | ||
|
||
struct SegmentedControlView_Previews: PreviewProvider { | ||
static var previews: some View { | ||
SegmentedControlView() | ||
} | ||
} |
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