From e00ca969e24ff26c2d7b2096198304311f1e7cda Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Wed, 28 Aug 2024 11:32:21 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#14=20-=20TextFieldStyle=EC=9D=84=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=9C=20custom=20textfield?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pophory-TCA.xcodeproj/project.pbxproj | 4 ++++ .../Assets/Components/PophoryTextField.swift | 20 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/pophory-TCA/pophory-TCA.xcodeproj/project.pbxproj b/pophory-TCA/pophory-TCA.xcodeproj/project.pbxproj index 374e7bd..fafd047 100644 --- a/pophory-TCA/pophory-TCA.xcodeproj/project.pbxproj +++ b/pophory-TCA/pophory-TCA.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 3B1C335F2C65B552001DB285 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3BC5851F2C6470FE003763AF /* Colors.xcassets */; }; 3B3B9BE42C675E6B00AF9D5C /* View+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B3B9BE32C675E6B00AF9D5C /* View+.swift */; }; 3B3B9BE62C675E7400AF9D5C /* ViewModifier+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B3B9BE52C675E7400AF9D5C /* ViewModifier+.swift */; }; + 3B3FEDE72C7D7056001B7A81 /* PophoryTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B3FEDE62C7D7056001B7A81 /* PophoryTextField.swift */; }; 3BC584D72C646530003763AF /* pophory_TCAApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC584D62C646530003763AF /* pophory_TCAApp.swift */; }; 3BC584D92C646530003763AF /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC584D82C646530003763AF /* ContentView.swift */; }; 3BC584E82C646531003763AF /* pophory_TCATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BC584E72C646531003763AF /* pophory_TCATests.swift */; }; @@ -45,6 +46,7 @@ 3B1C33602C65B5F3001DB285 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3B3B9BE32C675E6B00AF9D5C /* View+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+.swift"; sourceTree = ""; }; 3B3B9BE52C675E7400AF9D5C /* ViewModifier+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewModifier+.swift"; sourceTree = ""; }; + 3B3FEDE62C7D7056001B7A81 /* PophoryTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryTextField.swift; sourceTree = ""; }; 3BC584D32C646530003763AF /* pophory-TCA.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "pophory-TCA.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 3BC584D62C646530003763AF /* pophory_TCAApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = pophory_TCAApp.swift; sourceTree = ""; }; 3BC584D82C646530003763AF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -92,6 +94,7 @@ 3B00A4842C6B032000D851F1 /* Components */ = { isa = PBXGroup; children = ( + 3B3FEDE62C7D7056001B7A81 /* PophoryTextField.swift */, ); path = Components; sourceTree = ""; @@ -535,6 +538,7 @@ buildActionMask = 2147483647; files = ( 3B3B9BE42C675E6B00AF9D5C /* View+.swift in Sources */, + 3B3FEDE72C7D7056001B7A81 /* PophoryTextField.swift in Sources */, 3BC585352C64743E003763AF /* UIFontWithLineHeight.swift in Sources */, 3B3B9BE62C675E7400AF9D5C /* ViewModifier+.swift in Sources */, 3BC584D92C646530003763AF /* ContentView.swift in Sources */, diff --git a/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift b/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift index 8419bd3..bc1c770 100644 --- a/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift +++ b/pophory-TCA/pophory-TCA/Global/Assets/Components/PophoryTextField.swift @@ -7,9 +7,27 @@ import SwiftUI +struct PophoryTextFieldStyle: TextFieldStyle { + func _body(configuration: TextField) -> some View { + configuration + .padding(EdgeInsets(top: 19, leading: 15, bottom: 18, trailing: 18)) + .fontWithLineHeightView(fontType: .text01Medium) + .overlay( + RoundedRectangle(cornerRadius: 18) + .stroke(.pryPurple, lineWidth: 1.0) + ) + .onAppear { + UITextField.appearance().clearButtonMode = .whileEditing + } + } +} + struct PophoryTextField: View { + @State var text = "" + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + TextField("Hi...", text: $text) + .textFieldStyle(PophoryTextFieldStyle()) } }