Skip to content

Commit

Permalink
Merge pull request #441 from hyun99999/feature/#417
Browse files Browse the repository at this point in the history
feat: 명함 생성 전화번호 텍스트필드 기능 구현 (#417)
  • Loading branch information
hyun99999 authored Apr 21, 2023
2 parents 92714e8 + f74adf7 commit e3931d9
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 33 deletions.
16 changes: 8 additions & 8 deletions NADA-iOS-forRelease.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
F805588529C993E7002E8EA3 /* UpdateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F805588429C993E7002E8EA3 /* UpdateViewController.swift */; };
F80975E92990A27400075B93 /* Widgets.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F838B66A298E5C5300D84340 /* Widgets.intentdefinition */; };
F80975EA2990A27900075B93 /* Widgets.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = F838B66A298E5C5300D84340 /* Widgets.intentdefinition */; };
F80C679329F21BB7002C5ECC /* onboarding01.json in Resources */ = {isa = PBXBuildFile; fileRef = F80C679129F21BB7002C5ECC /* onboarding01.json */; };
F80C679429F21BB7002C5ECC /* onboarding02.json in Resources */ = {isa = PBXBuildFile; fileRef = F80C679229F21BB7002C5ECC /* onboarding02.json */; };
F811720027383097002742CF /* ChangeGroupRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F81171FF27383097002742CF /* ChangeGroupRequest.swift */; };
F822E7A92709CEB60020452C /* Notification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F822E7A82709CEB60020452C /* Notification.swift */; };
F8257750299546920067E145 /* Card.swift in Sources */ = {isa = PBXBuildFile; fileRef = F87122752733046300A24E74 /* Card.swift */; };
Expand Down Expand Up @@ -161,8 +163,6 @@
F88C8DE929B8919700196A33 /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = F88C8DE829B8919700196A33 /* ViewModelType.swift */; };
F8915A22275728F20013D609 /* SelectBirthBottomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8915A20275728F20013D609 /* SelectBirthBottomViewController.swift */; };
F8915A23275728F20013D609 /* SelectMBTIBottomViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8915A21275728F20013D609 /* SelectMBTIBottomViewController.swift */; };
F8A2777929EB1037006CC2AC /* onboarding01.json in Resources */ = {isa = PBXBuildFile; fileRef = F8A2777729EB1037006CC2AC /* onboarding01.json */; };
F8A2777A29EB1037006CC2AC /* onboarding02.json in Resources */ = {isa = PBXBuildFile; fileRef = F8A2777829EB1037006CC2AC /* onboarding02.json */; };
F8A9FE1A2743DC6B00BC60CE /* CardListInGroupRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8A9FE192743DC6B00BC60CE /* CardListInGroupRequest.swift */; };
F8BCDD22298FFA830044D0B4 /* QRCodeWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BCDD21298FFA830044D0B4 /* QRCodeWidget.swift */; };
F8BCDD24298FFA940044D0B4 /* OpenAppLockScreenWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8BCDD23298FFA940044D0B4 /* OpenAppLockScreenWidget.swift */; };
Expand Down Expand Up @@ -348,6 +348,8 @@
78FC1ADEA3CAB995C08D47DB /* Pods-NADA-iOS-forRelease.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NADA-iOS-forRelease.release.xcconfig"; path = "Target Support Files/Pods-NADA-iOS-forRelease/Pods-NADA-iOS-forRelease.release.xcconfig"; sourceTree = "<group>"; };
D86FBA2B7966CFE6EEF0E7E8 /* Pods_NADA_iOS_forRelease.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NADA_iOS_forRelease.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F805588429C993E7002E8EA3 /* UpdateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateViewController.swift; sourceTree = "<group>"; };
F80C679129F21BB7002C5ECC /* onboarding01.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = onboarding01.json; sourceTree = "<group>"; };
F80C679229F21BB7002C5ECC /* onboarding02.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = onboarding02.json; sourceTree = "<group>"; };
F81171FF27383097002742CF /* ChangeGroupRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeGroupRequest.swift; sourceTree = "<group>"; };
F822E7A82709CEB60020452C /* Notification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Notification.swift; sourceTree = "<group>"; };
F8268DB827730B0100BF114B /* FirstCardAlertBottomSheetViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstCardAlertBottomSheetViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -402,8 +404,6 @@
F88C8DE829B8919700196A33 /* ViewModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = "<group>"; };
F8915A20275728F20013D609 /* SelectBirthBottomViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectBirthBottomViewController.swift; sourceTree = "<group>"; };
F8915A21275728F20013D609 /* SelectMBTIBottomViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SelectMBTIBottomViewController.swift; sourceTree = "<group>"; };
F8A2777729EB1037006CC2AC /* onboarding01.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = onboarding01.json; path = ../../../../onboarding01.json; sourceTree = "<group>"; };
F8A2777829EB1037006CC2AC /* onboarding02.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = onboarding02.json; path = ../../../../onboarding02.json; sourceTree = "<group>"; };
F8A9FE192743DC6B00BC60CE /* CardListInGroupRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CardListInGroupRequest.swift; sourceTree = "<group>"; };
F8BCDD21298FFA830044D0B4 /* QRCodeWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeWidget.swift; sourceTree = "<group>"; };
F8BCDD23298FFA940044D0B4 /* OpenAppLockScreenWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenAppLockScreenWidget.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -982,8 +982,8 @@
isa = PBXGroup;
children = (
F8562C95296ADD1000DA1109 /* nearby.json */,
F8A2777729EB1037006CC2AC /* onboarding01.json */,
F8A2777829EB1037006CC2AC /* onboarding02.json */,
F80C679129F21BB7002C5ECC /* onboarding01.json */,
F80C679229F21BB7002C5ECC /* onboarding02.json */,
);
path = Lottie;
sourceTree = "<group>";
Expand Down Expand Up @@ -1528,7 +1528,6 @@
files = (
F8518058275D042B006BD5ED /* Onboarding.storyboard in Resources */,
F8FC43BF26C025180033E151 /* .swiftlint.yml in Resources */,
F8A2777929EB1037006CC2AC /* onboarding01.json in Resources */,
F88101F92987CBAF007266B5 /* GoogleService-Info.plist in Resources */,
397B75142763A916004AEB03 /* OpenSourceTableViewCell.xib in Resources */,
F85711A7274A6B3400F59F0B /* CardCreationPreview.storyboard in Resources */,
Expand All @@ -1540,6 +1539,7 @@
F858079F2700354E00872484 /* BackgroundCollectionViewCell.xib in Resources */,
F84BAFAE26FDB543004CA335 /* FrontCardCreationCollectionViewCell.xib in Resources */,
3958F23C270FFBD500B100B2 /* Group.storyboard in Resources */,
F80C679429F21BB7002C5ECC /* onboarding02.json in Resources */,
F83206AB26F61E3700D61711 /* FrontCardCell.xib in Resources */,
394F314F27081B4C00C83291 /* Front.storyboard in Resources */,
3979709826FA0BF0003FB4F5 /* Login.storyboard in Resources */,
Expand All @@ -1552,6 +1552,7 @@
397B75172763B5B7004AEB03 /* TeamNADA.storyboard in Resources */,
3936993B274A53C600684420 /* GroupEdit.storyboard in Resources */,
3903CC212769F4F40094C458 /* EmptyCardCell.xib in Resources */,
F80C679329F21BB7002C5ECC /* onboarding01.json in Resources */,
39D88B642745FDD400A72164 /* TabBar.storyboard in Resources */,
F8562C96296ADD1000DA1109 /* nearby.json in Resources */,
7766A410274FEBE200714912 /* CardInGroupCollectionViewCell.xib in Resources */,
Expand All @@ -1572,7 +1573,6 @@
39369937274A4FCB00684420 /* NotoSansCJKkr-Medium.otf in Resources */,
392F7FB5274621F1008CDBF5 /* MoreListTableViewCell.xib in Resources */,
7770315927500C49002CBD19 /* QRScan.storyboard in Resources */,
F8A2777A29EB1037006CC2AC /* onboarding02.json in Resources */,
390515B82706CEBB00C5F7A5 /* Colors.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class FrontCardCreationCollectionViewCell: UICollectionViewCell {
registerCell()
textFieldDelegate()
setNotification()
setAddTargets()
}
}

Expand Down Expand Up @@ -123,18 +124,24 @@ extension FrontCardCreationCollectionViewCell {
mbtiLabel.textColor = .quaternary
mbtiLabel.text = "MBTI"

instagramIDTextField.attributedPlaceholder = NSAttributedString(string: "Instagram (@ 제외)", attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
linkURLTextField.attributedPlaceholder = NSAttributedString(string: "URL (Github, Blog 등)", attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
descriptionTextField.attributedPlaceholder = NSAttributedString(string: "학교 전공/동아리 기수 등 (15자)", attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
phoneNumberTextField.attributedPlaceholder = NSAttributedString(string: "전화번호", attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
instagramIDTextField.attributedPlaceholder = NSAttributedString(string: "Instagram (@ 제외)",
attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
linkURLTextField.attributedPlaceholder = NSAttributedString(string: "URL (Github, Blog 등)",
attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
descriptionTextField.attributedPlaceholder = NSAttributedString(string: "학교 전공/동아리 기수 등 (15자)",
attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])
phoneNumberTextField.attributedPlaceholder = NSAttributedString(string: "전화번호",
attributes: [
NSAttributedString.Key.foregroundColor: UIColor.quaternary
])

phoneNumberTextField.keyboardType = .numberPad

_ = requiredTextFieldList.map {
$0.font = .textRegular04
Expand Down Expand Up @@ -217,6 +224,9 @@ extension FrontCardCreationCollectionViewCell {
defaultImageIndex: defaultImageIndex))
}
}
private func setAddTargets() {
phoneNumberTextField.addTarget(self, action: #selector(phoneNumberTextFieldDidChange), for: .editingChanged)
}
static func nib() -> UINib {
return UINib(nibName: Const.Xib.frontCardCreationCollectionViewCell, bundle: Bundle(for: FrontCardCreationCollectionViewCell.self))
}
Expand Down Expand Up @@ -321,6 +331,22 @@ extension FrontCardCreationCollectionViewCell {
backgroundSettingCollectionView.deselectItem(at: IndexPath.init(item: 0, section: 0), animated: true)
}
}
@objc
private func phoneNumberTextFieldDidChange() {
if let text = phoneNumberTextField.text?.replacingOccurrences(of: "-", with: "") {
let textArray = text.map { String($0) }

if text.count < 10 {
phoneNumberTextField.text = text
} else if text.count == 10 {
phoneNumberTextField.text = textArray[0...2].joined() + "-" + textArray[3...5].joined() + "-" + textArray[6...9].joined()
} else if text.count == 11 {
phoneNumberTextField.text = textArray[0...2].joined() + "-" + textArray[3...6].joined() + "-" + textArray[7...10].joined()
} else {
phoneNumberTextField.text = text
}
}
}
}

// MARK: - UICollectionViewDelegate
Expand Down
26 changes: 13 additions & 13 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ PODS:
- GoogleUtilities/Environment
- "GoogleUtilities/NSData+zlib (7.11.1)"
- IQKeyboardManagerSwift (6.5.11)
- KakaoSDKAuth (2.14.0):
- KakaoSDKCommon (= 2.14.0)
- KakaoSDKCommon (2.14.0):
- KakaoSDKCommon/Common (= 2.14.0)
- KakaoSDKCommon/Network (= 2.14.0)
- KakaoSDKCommon/Common (2.14.0)
- KakaoSDKCommon/Network (2.14.0):
- KakaoSDKAuth (2.15.0):
- KakaoSDKCommon (= 2.15.0)
- KakaoSDKCommon (2.15.0):
- KakaoSDKCommon/Common (= 2.15.0)
- KakaoSDKCommon/Network (= 2.15.0)
- KakaoSDKCommon/Common (2.15.0)
- KakaoSDKCommon/Network (2.15.0):
- Alamofire (~> 5.1)
- KakaoSDKCommon/Common (= 2.14.0)
- KakaoSDKUser (2.14.0):
- KakaoSDKAuth (= 2.14.0)
- KakaoSDKCommon/Common (= 2.15.0)
- KakaoSDKUser (2.15.0):
- KakaoSDKAuth (= 2.15.0)
- Kingfisher (7.6.2)
- lottie-ios (4.1.3)
- Moya (15.0.0):
Expand Down Expand Up @@ -120,9 +120,9 @@ SPEC CHECKSUMS:
FlexLayout: 8010187077ecf09710cdf0e9c8ffe2c9b92ec5db
GoogleUtilities: 9aa0ad5a7bc171f8bae016300bfcfa3fb8425749
IQKeyboardManagerSwift: c7955c0bdbf7b2eb29bb7daaa44e3d90f55a9a85
KakaoSDKAuth: 8fca87815de22062a23297983f327613b087b8bb
KakaoSDKCommon: 0ce638f7a2e49704943c0b74a087a9f8067bba1c
KakaoSDKUser: 2ca18314ce72e6690f76cb1f6f9fbc771d31a803
KakaoSDKAuth: 0fe5cf1756e8a9f66f8fc77826061aafa93034f3
KakaoSDKCommon: 89d863b7f34398e6fb93a0acb28a204908551a39
KakaoSDKUser: a997ca5c4c18ece2ab30646ff74841bc29d4399d
Kingfisher: 6c5449c6450c5239166510ba04afe374a98afc4f
lottie-ios: d0954d3150061f662ed0adf96ef98d7421864c47
Moya: 138f0573e53411fb3dc17016add0b748dfbd78ee
Expand Down

0 comments on commit e3931d9

Please sign in to comment.