Skip to content

Commit

Permalink
[#55] TextField 관련 코드 정리 및 샘플 페이지 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyuni committed Aug 22, 2021
1 parent 6fe69d3 commit cd930b5
Show file tree
Hide file tree
Showing 15 changed files with 425 additions and 360 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// PasswordTextFieldViewPageViewController.swift
// YDS-Sample
//
// Created by Gyuni on 2021/08/23.
//

import UIKit
import YDS
import SnapKit

class PasswordTextFieldViewPageViewController: StoryBookViewController {

let sampleTextFieldView: YDSPasswordTextFieldView = {
let textFieldView = YDSPasswordTextFieldView()
return textFieldView
}()

override func viewDidLoad() {
super.viewDidLoad()
setupView()
addOptions()
}

private func setupView() {
setViewProperty()
setViewHierarchy()
setAutolayout()
}

private func setViewProperty() {
self.title = "PasswordTextFieldView"
self.sampleView.backgroundColor = YDSColor.bgNormal
}

private func setViewHierarchy() {
sampleView.addSubview(sampleTextFieldView)

}

private func setAutolayout() {
sampleTextFieldView.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(20)
}
}

private func addOptions() {
addOption(description: "fieldLabelText",
defaultValue: "비밀번호") { [weak self] value in
self?.sampleTextFieldView.fieldLabelText = value
}

addOption(description: "placeholder",
defaultValue: "1q2w3e4r!") { [weak self] value in
self?.sampleTextFieldView.placeholder = value
}

addOption(description: "helperLabelText",
defaultValue: "숫자와 영문자 조합으로 8자 이상 입력해 주세요.") { [weak self] value in
self?.sampleTextFieldView.helperLabelText = value
}

addOption(description: "isDisabled",
defaultValue: false) { [weak self] value in
self?.sampleTextFieldView.isDisabled = value
}

addOption(description: "isNegative",
defaultValue: false) { [weak self] value in
self?.sampleTextFieldView.isNegative = value
}

addOption(description: "isPositive",
defaultValue: false) { [weak self] value in
self?.sampleTextFieldView.isPositive = value
}
}


}

extension PasswordTextFieldViewPageViewController {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
sampleTextFieldView.textField.endEditing(true)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// SearchBarPageViewController.swift
// YDS-Sample
//
// Created by Gyuni on 2021/08/23.
//

import UIKit
import YDS
import SnapKit

class SearchBarPageViewController: StoryBookViewController {

let sampleSearchBar: YDSSearchBar = {
let searchBar = YDSSearchBar()
return searchBar
}()

override func viewDidLoad() {
super.viewDidLoad()
setupView()
addOptions()
self.extendedLayoutIncludesOpaqueBars = true
self.navigationItem.titleView = sampleSearchBar
}

private func setupView() {
setViewProperty()
}

private func setViewProperty() {
self.title = "SearchBar"
}

private func addOptions() {
addOption(description: "placeholder",
defaultValue: "검색어를 입력해주세요.") { [weak self] value in
self?.sampleSearchBar.placeholder = value
}

addOption(description: "isDisabled",
defaultValue: false) { [weak self] value in
self?.sampleSearchBar.isDisabled = value
}
}

}

extension SearchBarPageViewController {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
sampleSearchBar.endEditing(true)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// SearchTextFieldPageViewController.swift
// YDS-Sample
//
// Created by Gyuni on 2021/08/23.
//

import UIKit
import YDS
import SnapKit

class SearchTextFieldPageViewController: StoryBookViewController {

let sampleTextField: YDSSearchTextField = {
let textField = YDSSearchTextField()
return textField
}()

override func viewDidLoad() {
super.viewDidLoad()
setupView()
addOptions()
}

private func setupView() {
setViewProperty()
setViewHierarchy()
setAutolayout()
}

private func setViewProperty() {
self.title = "SearchTextField"
self.sampleView.backgroundColor = YDSColor.bgNormal
}

private func setViewHierarchy() {
sampleView.addSubview(sampleTextField)

}

private func setAutolayout() {
sampleTextField.snp.makeConstraints {
$0.centerY.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(20)
}
}

private func addOptions() {
addOption(description: "placeholder",
defaultValue: "검색어를 입력해주세요.") { [weak self] value in
self?.sampleTextField.placeholder = value
}

addOption(description: "isDisabled",
defaultValue: false) { [weak self] value in
self?.sampleTextField.isDisabled = value
}
}


}

extension SearchTextFieldPageViewController {
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
sampleTextField.endEditing(true)
}
}

This file was deleted.

Loading

0 comments on commit cd930b5

Please sign in to comment.