Skip to content

Commit

Permalink
- TextField learning
Browse files Browse the repository at this point in the history
  • Loading branch information
DiviJain committed Jul 2, 2020
1 parent e7b8995 commit 1d30867
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SwiftUILearning.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
EE024CDC24AE1FAF0044460A /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE024CDB24AE1FAF0044460A /* Preview Assets.xcassets */; };
EE024CDF24AE1FAF0044460A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE024CDD24AE1FAF0044460A /* LaunchScreen.storyboard */; };
EE024CEA24AE1FAF0044460A /* SwiftUILearningTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE024CE924AE1FAF0044460A /* SwiftUILearningTests.swift */; };
EE024D0924AE67520044460A /* TextFieldUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE024D0824AE67520044460A /* TextFieldUI.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -38,6 +39,7 @@
EE024CE524AE1FAF0044460A /* SwiftUILearningTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftUILearningTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
EE024CE924AE1FAF0044460A /* SwiftUILearningTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUILearningTests.swift; sourceTree = "<group>"; };
EE024CEB24AE1FAF0044460A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
EE024D0824AE67520044460A /* TextFieldUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldUI.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -81,6 +83,7 @@
children = (
EE024CD224AE1FAA0044460A /* AppDelegate.swift */,
EE024CD424AE1FAA0044460A /* SceneDelegate.swift */,
EE024D0824AE67520044460A /* TextFieldUI.swift */,
EE024CD624AE1FAA0044460A /* ContentView.swift */,
EE024CD824AE1FAF0044460A /* Assets.xcassets */,
EE024CDD24AE1FAF0044460A /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -211,6 +214,7 @@
EE024CD324AE1FAA0044460A /* AppDelegate.swift in Sources */,
EE024CD524AE1FAA0044460A /* SceneDelegate.swift in Sources */,
EE024CD724AE1FAA0044460A /* ContentView.swift in Sources */,
EE024D0924AE67520044460A /* TextFieldUI.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
47 changes: 47 additions & 0 deletions SwiftUILearning/TextFieldUI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// TextFieldUI.swift
// SwiftUILearning
//
// Created by Jain, Divya on 03/07/20.
// Copyright © 2020 Jain, Divya. All rights reserved.
//

import SwiftUI

struct TextFieldUI: View {
@State private var color = Color.red
@State private var text = "\\O , O/ \n ^"

var body: some View {
VStack(spacing: 30) {
Text(text)
.padding()
.background(self.color)
.cornerRadius(50)
.foregroundColor(Color.black)
.shadow(color: Color.red, radius: 10, x: 0, y: 0)
.overlay(
RoundedRectangle(cornerRadius: 50)
.stroke(Color.red, lineWidth: 2)
)
.colorMultiply(Color.yellow)
.onTapGesture {
withAnimation(.easeInOut(duration: 1)) {
self.color = Color.yellow
self.text = "\\O , O/ \n v"

}
}

Text("TAP ME To make me smile")
.font(.system(size: 25, weight: .bold, design: .default))

}
}
}

struct TextFieldUI_Previews: PreviewProvider {
static var previews: some View {
TextFieldUI()
}
}

0 comments on commit 1d30867

Please sign in to comment.