Skip to content

Commit

Permalink
[Feat] #14 - TextFieldStyle을 사용한 custom textfield
Browse files Browse the repository at this point in the history
  • Loading branch information
yungu0010 committed Aug 28, 2024
1 parent 127c6f8 commit e00ca96
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pophory-TCA/pophory-TCA.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -45,6 +46,7 @@
3B1C33602C65B5F3001DB285 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
3B3B9BE32C675E6B00AF9D5C /* View+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+.swift"; sourceTree = "<group>"; };
3B3B9BE52C675E7400AF9D5C /* ViewModifier+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewModifier+.swift"; sourceTree = "<group>"; };
3B3FEDE62C7D7056001B7A81 /* PophoryTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PophoryTextField.swift; sourceTree = "<group>"; };
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 = "<group>"; };
3BC584D82C646530003763AF /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -92,6 +94,7 @@
3B00A4842C6B032000D851F1 /* Components */ = {
isa = PBXGroup;
children = (
3B3FEDE62C7D7056001B7A81 /* PophoryTextField.swift */,
);
path = Components;
sourceTree = "<group>";
Expand Down Expand Up @@ -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 */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,27 @@

import SwiftUI

struct PophoryTextFieldStyle: TextFieldStyle {
func _body(configuration: TextField<Self._Label>) -> 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())
}
}

Expand Down

0 comments on commit e00ca96

Please sign in to comment.