Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class FlintTextField: UITextField {
attributedText = .pretendard(.body1_r_16, text: text ?? "")
attributedPlaceholder = .pretendard(.body1_r_16, text: placeholder, color: .flintGray300)

addAction(UIAction(handler: updateLengthLabel(_:)), for: .editingChanged)
addAction(UIAction(weak: self, handler: FlintTextField.updateLengthLabel(_:)), for: .editingChanged)
lengthLabel.isHidden = !showLength || maxLength == nil

onLengthChanged?(text?.count ?? 0, maxLength ?? 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public final class SearchTextField: UITextField {
}

private func setAction() {
actionButton.addAction(UIAction(handler: touchUpInsideActionButton(_:)), for: .touchUpInside)
actionButton.addAction(UIAction(weak: self, handler: SearchTextField.touchUpInsideActionButton(_:)), for: .touchUpInside)

addAction(UIAction(handler: { [weak self] _ in
self?.actionButton.setImage(.icCancel, for: .normal)
Expand Down
20 changes: 20 additions & 0 deletions FLINT/Presentation/Sources/View/Extension/UIAction+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// UIAction+.swift
// Presentation
//
// Created by 루미씨티 on 4/14/26.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

누군데 회사에서햇짘ㅋㅋㅋㅋ

//

import UIKit

extension UIAction {
public convenience init<T: AnyObject>(
weak target: T,
handler: @escaping @Sendable (T) -> @Sendable (UIAction) -> Void
) {
self.init { [weak target] action in
guard let target else { return }
handler(target)(action)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public final class NicknameView: BaseView {
public override init(frame: CGRect) {
super.init(frame: frame)

nicknameTextField.addAction(UIAction(handler: nicknameTextFieldEditingChanged(_:)), for: .editingChanged)
nicknameTextField.addAction(UIAction(weak: self, handler: NicknameView.nicknameTextFieldEditingChanged(_:)), for: .editingChanged)
}

required init?(coder: NSCoder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ extension ExploreViewController {

case .empty:
let cell = collectionView.dequeueReusableCell(ExploreEmptyCollectionViewCell.self, for: indexPath)
cell.createCollectionButton.addAction(UIAction(handler: pushCreateCollectionViewController(_:)), for: .touchUpInside)
cell.createCollectionButton.addAction(UIAction(weak: self, handler: ExploreViewController.pushCreateCollectionViewController(_:)), for: .touchUpInside)
return cell
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class LoginViewController: BaseViewController<LoginView> {
public override func viewDidLoad() {
super.viewDidLoad()

rootView.kakaoButton.addAction(UIAction(handler: kakaoLogin(_:)), for: .touchUpInside)
rootView.kakaoButton.addAction(UIAction(weak: self, handler: LoginViewController.kakaoLogin(_:)), for: .touchUpInside)
}

public override func bind() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public final class ContentSelectViewController: BaseViewController<ContentSelect
rootView.layoutIfNeeded()
rootView.contentCollectionView.contentOffset.y = -rootView.contentCollectionView.contentInset.top

rootView.nextButton.addAction(UIAction(handler: pushOttSelectViewController(_:)), for: .touchUpInside)
rootView.nextButton.addAction(UIAction(weak: self, handler: ContentSelectViewController.pushOttSelectViewController(_:)), for: .touchUpInside)
}

public override func bind() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class OnboardingDoneViewController: BaseViewController<OnboardingDo
super.viewDidLoad()

setNavigationBar(.init(left: .back))
rootView.startButton.addAction(UIAction(handler: completeOnboarding(_:)), for: .touchUpInside)
rootView.startButton.addAction(UIAction(weak: self, handler: OnboardingDoneViewController.completeOnboarding(_:)), for: .touchUpInside)
}

public override func bind() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ public final class NicknameViewController: BaseViewController<NicknameView> {
// MARK: - Private Function

private func addActions() {
rootView.profileImageSettingView.settingButton.addAction(UIAction(handler: showProfileImageSettingAlert(_:)), for: .touchUpInside)
rootView.verifyButton.addAction(UIAction(handler: verifyNickname(_:)), for: .touchUpInside)
rootView.nextButton.addAction(UIAction(handler: nextButtonTapped(_:)), for: .touchUpInside)
rootView.profileImageSettingView.settingButton.addAction(UIAction(weak: self, handler: NicknameViewController.showProfileImageSettingAlert(_:)), for: .touchUpInside)
rootView.verifyButton.addAction(UIAction(weak: self, handler: NicknameViewController.verifyNickname(_:)), for: .touchUpInside)
rootView.nextButton.addAction(UIAction(weak: self, handler: NicknameViewController.nextButtonTapped(_:)), for: .touchUpInside)
}

private func showProfileImageSettingAlert(_ action: UIAction) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class OttSelectViewController: BaseViewController<OttSelectView> {
rootView.titleLabel.attributedText = .pretendard(.display2_m_28, text: "얀비 님이 구독 중인 OTT 서비스를 알려주세요", lineBreakMode: .byWordWrapping, lineBreakStrategy: .hangulWordPriority)
rootView.ottCollectionView.dataSource = self
rootView.ottCollectionView.delegate = self
rootView.nextButton.addAction(UIAction(handler: pushOnboardingDoneViewController(_:)), for: .touchUpInside)
rootView.nextButton.addAction(UIAction(weak: self, handler: OttSelectViewController.pushOnboardingDoneViewController(_:)), for: .touchUpInside)
}

public override func bind() {
Expand Down