Browse Source

error text field and label initialized

pull/1/head
gme_2 6 years ago
parent
commit
ae30cd0d86
  1. 89
      GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard
  2. 95
      GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift

89
GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard

@ -30,10 +30,10 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="1300"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Ulz-yj-JUf">
<rect key="frame" x="0.0" y="0.0" width="375" height="1167"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="1075"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Cx7-yC-Iyy">
<rect key="frame" x="0.0" y="0.0" width="5" height="1167"/>
<rect key="frame" x="0.0" y="0.0" width="5" height="1075"/>
<constraints>
<constraint firstAttribute="width" constant="5" id="Loe-0S-vzZ"/>
</constraints>
@ -42,7 +42,7 @@
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="20" translatesAutoresizingMaskIntoConstraints="NO" id="5Yj-58-A1e">
<rect key="frame" x="5" y="0.0" width="365" height="1167"/>
<rect key="frame" x="5" y="0.0" width="365" height="1075"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="fHx-i6-TAt">
<rect key="frame" x="0.0" y="0.0" width="365" height="50"/>
@ -60,7 +60,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="QtF-v5-ULz">
<rect key="frame" x="0.0" y="70" width="365" height="1097"/>
<rect key="frame" x="0.0" y="70" width="365" height="1005"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="MuX-Si-40N">
<rect key="frame" x="0.0" y="0.0" width="365" height="82"/>
@ -158,40 +158,8 @@
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="Mkc-Lj-hRT">
<rect key="frame" x="0.0" y="276" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Nick Name (Will be displayed in your profile)" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zvx-b8-wO7">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="CO6-dQ-vRy"/>
</constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="error" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zPp-ww-Zjw">
<rect key="frame" x="0.0" y="19.5" width="365" height="14.5"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="Oxx-rM-0t1"/>
</constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/>
<color key="textColor" red="0.2901960784" green="0.2901960784" blue="0.2901960784" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Enter your Nick Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="EgQ-B4-u1x">
<rect key="frame" x="0.0" y="39" width="365" height="43"/>
<constraints>
<constraint firstAttribute="height" constant="43" id="Wqp-3W-DXf"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
</textField>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="9IE-gI-ZYn">
<rect key="frame" x="0.0" y="368" width="365" height="82"/>
<rect key="frame" x="0.0" y="276" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Gender" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bPf-Nl-7DP">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
@ -223,7 +191,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="tlY-ip-g4p">
<rect key="frame" x="0.0" y="460" width="365" height="82"/>
<rect key="frame" x="0.0" y="368" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Date of Birth" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="exz-v7-Ii8">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
@ -255,7 +223,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="ZS4-HL-Kzg">
<rect key="frame" x="0.0" y="552" width="365" height="82"/>
<rect key="frame" x="0.0" y="460" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Mobile No." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pOi-J4-HpV">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
@ -287,7 +255,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="aBI-2t-Tak">
<rect key="frame" x="0.0" y="644" width="365" height="82"/>
<rect key="frame" x="0.0" y="552" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Email Address" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lrG-sR-08m">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
@ -319,7 +287,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="Oi0-Od-8ks">
<rect key="frame" x="0.0" y="736" width="365" height="83"/>
<rect key="frame" x="0.0" y="644" width="365" height="83"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Native Country" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UGo-bk-Rq9">
<rect key="frame" x="0.0" y="0.0" width="365" height="15"/>
@ -351,7 +319,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="VKC-oG-zQf">
<rect key="frame" x="0.0" y="829" width="365" height="83"/>
<rect key="frame" x="0.0" y="737" width="365" height="83"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Country" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qfd-4I-OvP">
<rect key="frame" x="0.0" y="0.0" width="365" height="15"/>
@ -383,7 +351,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="dAp-gm-h7D">
<rect key="frame" x="0.0" y="922" width="365" height="83"/>
<rect key="frame" x="0.0" y="830" width="365" height="83"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Province" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d1k-Xs-axj">
<rect key="frame" x="0.0" y="0.0" width="365" height="15"/>
@ -415,7 +383,7 @@
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="T5L-LD-asN">
<rect key="frame" x="0.0" y="1015" width="365" height="82"/>
<rect key="frame" x="0.0" y="923" width="365" height="82"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Occupation" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aYD-8r-p9B">
<rect key="frame" x="0.0" y="0.0" width="365" height="14.5"/>
@ -452,7 +420,7 @@
</subviews>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Cn4-Hf-O4w">
<rect key="frame" x="370" y="0.0" width="5" height="1167"/>
<rect key="frame" x="370" y="0.0" width="5" height="1075"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
@ -463,7 +431,7 @@
</constraints>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4QD-n7-cbc">
<rect key="frame" x="87" y="1167" width="200" height="50"/>
<rect key="frame" x="87" y="1125" width="200" height="50"/>
<color key="backgroundColor" red="0.92941176469999998" green="0.10980392160000001" blue="0.14117647059999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="Fgp-3E-J5P"/>
@ -478,12 +446,15 @@
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="save:" destination="HSb-ou-7T5" eventType="touchUpInside" id="aC1-EX-hcF"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="4QD-n7-cbc" secondAttribute="bottom" id="Erm-Mb-Eef"/>
<constraint firstItem="4QD-n7-cbc" firstAttribute="top" secondItem="Ulz-yj-JUf" secondAttribute="bottom" id="GBy-wV-Yc7"/>
<constraint firstItem="4QD-n7-cbc" firstAttribute="top" secondItem="Ulz-yj-JUf" secondAttribute="bottom" constant="50" id="GBy-wV-Yc7"/>
<constraint firstItem="Ulz-yj-JUf" firstAttribute="leading" secondItem="ixK-Bl-e32" secondAttribute="leading" id="Ii3-fB-cp1"/>
<constraint firstItem="4QD-n7-cbc" firstAttribute="centerX" secondItem="ixK-Bl-e32" secondAttribute="centerX" id="Jam-s2-S0E"/>
<constraint firstItem="Ulz-yj-JUf" firstAttribute="top" secondItem="ixK-Bl-e32" secondAttribute="top" id="Q7E-6t-n6d"/>
@ -502,6 +473,30 @@
</constraints>
</view>
<size key="freeformSize" width="375" height="1300"/>
<connections>
<outlet property="countryErrorLabel" destination="yZy-Av-oFf" id="l1p-sE-vUI"/>
<outlet property="countryTextField" destination="bRp-8B-RFU" id="WmC-OZ-7Tm"/>
<outlet property="dobErrorLabel" destination="If1-lU-OXh" id="01a-GR-voo"/>
<outlet property="dobTextField" destination="hEk-Wb-CTe" id="MC5-d9-N0I"/>
<outlet property="emailErrorLabel" destination="IuA-we-6Ky" id="HZ9-br-WGz"/>
<outlet property="emailTextField" destination="P4e-l6-JXm" id="PSB-hc-8W7"/>
<outlet property="firstNameErrorLabel" destination="6Gb-uL-YsM" id="pwj-ua-MWY"/>
<outlet property="firstNameTextField" destination="wBc-TT-A5d" id="HTN-9o-BiL"/>
<outlet property="genderErrorLabel" destination="uRv-YS-eaE" id="l4c-4j-tvi"/>
<outlet property="genderTextField" destination="jMe-PA-j1d" id="phC-Xc-vtJ"/>
<outlet property="lastNameErrorLabel" destination="Wnv-wb-C2S" id="eEZ-Xm-wNz"/>
<outlet property="lastNameTextField" destination="0xU-qC-J9J" id="IY9-Cg-y9Z"/>
<outlet property="middleNameErrorLabel" destination="tJl-Dj-BpS" id="MXj-Cc-uYQ"/>
<outlet property="middleNmaeTextField" destination="Kfc-8L-wAi" id="t6Q-HT-I0u"/>
<outlet property="mobileNumberErrorLabel" destination="kdz-bY-Yvt" id="3sF-tv-vFn"/>
<outlet property="mobileNumberTextField" destination="e0l-hm-b9a" id="Wm8-Ih-A2H"/>
<outlet property="nativeCountryErrorLabel" destination="AKa-mq-dNv" id="Wel-LU-ayJ"/>
<outlet property="nativeCountryTextField" destination="cXS-dQ-HBb" id="7G7-fT-Pym"/>
<outlet property="occupationErrorLabel" destination="AeT-CH-RYG" id="EqW-HP-MVn"/>
<outlet property="occupationTextField" destination="ayn-DP-9bq" id="Yzu-LO-qYT"/>
<outlet property="provinceErrorLabel" destination="rqL-H3-Mlf" id="fh6-zB-S6J"/>
<outlet property="provinceTextField" destination="SC9-rY-28Z" id="3vx-ba-VhU"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8je-5K-XuW" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>

95
GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift

@ -14,14 +14,57 @@ class KycForm1ViewController: UIViewController {
struct Constants {
static let segmentBackgroundViewColor = UIColor.init(hex: "E7EDF2")
}
struct FieldKeys {
static let firstName = "firstName"
static let middleName = "middleName"
static let lastName = "lastName"
static let gender = "gender"
static let dob = "dob"
static let mobileNumber = "mobileNumber"
static let email = "email"
static let nativeCountry = "nativeCountry"
static let country = "country"
static let province = "province"
static let occupation = "occupation"
}
// MARK: IBOutlets
// validation labels
@IBOutlet weak var firstNameErrorLabel: UILabel!
@IBOutlet weak var middleNameErrorLabel: UILabel!
@IBOutlet weak var lastNameErrorLabel: UILabel!
@IBOutlet weak var genderErrorLabel: UILabel!
@IBOutlet weak var dobErrorLabel: UILabel!
@IBOutlet weak var mobileNumberErrorLabel: UILabel!
@IBOutlet weak var emailErrorLabel: UILabel!
@IBOutlet weak var nativeCountryErrorLabel: UILabel!
@IBOutlet weak var countryErrorLabel: UILabel!
@IBOutlet weak var provinceErrorLabel: UILabel!
@IBOutlet weak var occupationErrorLabel: UILabel!
// textfields
@IBOutlet weak var firstNameTextField: UITextField!
@IBOutlet weak var middleNmaeTextField: UITextField!
@IBOutlet weak var lastNameTextField: UITextField!
@IBOutlet weak var genderTextField: UITextField!
@IBOutlet weak var dobTextField: UITextField!
@IBOutlet weak var mobileNumberTextField: UITextField!
@IBOutlet weak var emailTextField: UITextField!
@IBOutlet weak var nativeCountryTextField: UITextField!
@IBOutlet weak var countryTextField: UITextField!
@IBOutlet weak var provinceTextField: UITextField!
@IBOutlet weak var occupationTextField: UITextField!
// MARK: Properties
@IBOutlet var segmentBackgroundViews: [UIView]!
var presenter: KycForm1ModuleInterface?
var errorTextFieldDict: [String: UITextField] = [:]
var errorLabelsDict: [String: UILabel] = [:]
// MARK: VC's Life cycle
@ -32,13 +75,57 @@ class KycForm1ViewController: UIViewController {
// MARK: IBActions
@IBAction func save(_ sender: UIButton) {
}
// MARK: Other Functions
private func setup() {
// all setup should be done here
self.segmentBackgroundViews.forEach({
$0.layer.cornerRadius = 4
})
hideErrorLabels()
setupErrorLabels()
setupErrorTextFields()
}
private func hideErrorLabels() {
[firstNameErrorLabel, middleNameErrorLabel, lastNameErrorLabel, genderErrorLabel, dobErrorLabel, mobileNumberErrorLabel, emailErrorLabel, nativeCountryErrorLabel, countryErrorLabel, provinceErrorLabel, occupationErrorLabel].forEach({
$0?.isHidden = true
})
}
private func setupErrorLabels() {
self.errorLabelsDict =
[
FieldKeys.firstName: self.firstNameErrorLabel,
FieldKeys.middleName: self.middleNameErrorLabel,
FieldKeys.lastName: self.lastNameErrorLabel,
FieldKeys.gender: self.genderErrorLabel,
FieldKeys.dob: self.dobErrorLabel,
FieldKeys.mobileNumber: self.mobileNumberErrorLabel,
FieldKeys.email: self.emailErrorLabel,
FieldKeys.nativeCountry: self.nativeCountryErrorLabel,
FieldKeys.country: self.countryErrorLabel,
FieldKeys.province: self.provinceErrorLabel,
FieldKeys.occupation: self.occupationErrorLabel
]
}
private func setupErrorTextFields() {
self.errorTextFieldDict =
[
FieldKeys.firstName: self.firstNameTextField,
FieldKeys.middleName: self.middleNmaeTextField,
FieldKeys.lastName: self.lastNameTextField,
FieldKeys.gender: self.genderTextField,
FieldKeys.dob: self.dobTextField,
FieldKeys.mobileNumber: self.mobileNumberTextField,
FieldKeys.email: self.emailTextField,
FieldKeys.nativeCountry: self.nativeCountryTextField,
FieldKeys.country: self.countryTextField,
FieldKeys.province: self.provinceTextField,
FieldKeys.occupation: self.occupationTextField
]
}
}

Loading…
Cancel
Save