Skip to content

Commit

Permalink
[Chore] sopt-makers#8- 접근 제한자 public 으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
devxsby committed Nov 28, 2022
1 parent 83e2126 commit 967aa8c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import UIKit

import Core

final class CustomButton: UIButton {
public class CustomButton: UIButton {

// MARK: - Initialize

init(title: String) {
public init(title: String) {
super.init(frame: .zero)
self.setUI(title)
}
Expand All @@ -29,14 +29,14 @@ final class CustomButton: UIButton {
extension CustomButton {
/// 버튼의 enable 여부 설정
@discardableResult
func setEnabled(_ isEnabled: Bool) -> Self {
public func setEnabled(_ isEnabled: Bool) -> Self {
self.isEnabled = isEnabled
return self
}

/// 버튼의 Title 변경
@discardableResult
func changeTitle(attributedString: NSAttributedString) -> Self {
public func changeTitle(attributedString: NSAttributedString) -> Self {
self.setAttributedTitle(attributedString, for: .normal)
return self
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Then
import Core

@frozen
enum TextFieldViewType {
public enum TextFieldViewType {
case plain
case subTitle
case titleWithRightButton
Expand All @@ -33,14 +33,14 @@ enum TextFieldViewType {
}

@frozen
enum TextFieldType {
public enum TextFieldType {
case email
case password
case none
}

@frozen
enum TextFieldViewState {
public enum TextFieldViewState {
case normal
case editing
case alert
Expand Down Expand Up @@ -68,7 +68,7 @@ enum TextFieldViewState {
}
}

final class CustomTextFieldView: UIView {
public class CustomTextFieldView: UIView {

// MARK: - Properties

Expand Down Expand Up @@ -103,7 +103,7 @@ final class CustomTextFieldView: UIView {

// MARK: - Initialize

init(type: TextFieldViewType) {
public init(type: TextFieldViewType) {
super.init(frame: .zero)
self.type = type
self.setUI()
Expand All @@ -122,21 +122,21 @@ final class CustomTextFieldView: UIView {
extension CustomTextFieldView {
/// 버튼의 타이틀 변경
@discardableResult
func setTitle(_ titleText: String) -> Self {
public func setTitle(_ titleText: String) -> Self {
self.titleLabel.text = titleText
return self
}

/// textContainerView 내부의 subTitle text 변경
@discardableResult
func setSubTitle(_ subTitleText: String) -> Self {
public func setSubTitle(_ subTitleText: String) -> Self {
self.subTitleLabel.text = subTitleText
return self
}

/// placeholder text 변경
@discardableResult
func setPlaceholder(_ placeholderText: String) -> Self {
public func setPlaceholder(_ placeholderText: String) -> Self {
self.textField.attributedPlaceholder = NSAttributedString(
string: placeholderText,
attributes: [
Expand All @@ -149,15 +149,15 @@ extension CustomTextFieldView {

/// cornerRadius 설정
@discardableResult
func setCornerRadius(_ radius: CGFloat) -> Self {
public func setCornerRadius(_ radius: CGFloat) -> Self {
self.textFieldContainerView.layer.cornerRadius = radius
self.rightButton.layer.cornerRadius = radius
return self
}

/// TextFieldType에 맞는 키보드, 텍스트 필드 보안 처리 (이메일, 비밀번호 등)
@discardableResult
func setTextFieldType(_ type: TextFieldType) -> Self {
public func setTextFieldType(_ type: TextFieldType) -> Self {
switch type {
case .email:
self.textField.keyboardType = .emailAddress
Expand All @@ -171,7 +171,7 @@ extension CustomTextFieldView {

/// 하단에 경고 문구 라벨 생성
@discardableResult
func setAlertLabelEnabled(_ alertText: String) -> Self {
public func setAlertLabelEnabled(_ alertText: String) -> Self {
self.snp.updateConstraints { make in
make.height.equalTo(self.type.height + 26)
}
Expand All @@ -187,7 +187,7 @@ extension CustomTextFieldView {
}

/// 경고 문구 라벨의 text 설정
func changeAlertLabelText(_ alertText: String) {
public func changeAlertLabelText(_ alertText: String) {
self.alertlabel.text = alertText
}

Expand All @@ -196,7 +196,7 @@ extension CustomTextFieldView {
}

/// textField의 state를 지정하여 자동으로 배경색과 테두리 색이 바뀌도록 설정
func setTextFieldViewState(_ state: TextFieldViewState) {
public func setTextFieldViewState(_ state: TextFieldViewState) {
textFieldContainerView.backgroundColor = state.backgroundColor

if let borderColor = state.borderColor {
Expand Down Expand Up @@ -349,11 +349,11 @@ extension CustomTextFieldView {
// MARK: - UITextFieldDelegate

extension CustomTextFieldView: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
public func textFieldDidBeginEditing(_ textField: UITextField) {
self.setTextFieldViewState(.editing)
}

func textFieldDidEndEditing(_ textField: UITextField) {
public func textFieldDidEndEditing(_ textField: UITextField) {
self.setTextFieldViewState(.normal)
}
}

0 comments on commit 967aa8c

Please sign in to comment.