Skip to content

Commit

Permalink
fix : EditSentence 수정 #7
Browse files Browse the repository at this point in the history
- nextButton -> saveButton 으로 네이밍 수정
- 버튼 탭시 데이터 전달
  • Loading branch information
wongbingg committed Aug 8, 2023
1 parent 4b243c0 commit b07c41a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protocol EditSentencePresentable: Presentable {

protocol EditSentenceListener: AnyObject {
// TODO: Declare methods the interactor can invoke to communicate with other RIBs.
func dismissEditSentence()
func dismissEditSentence(with text: String)
}

final class EditSentenceInteractor: PresentableInteractor<EditSentencePresentable>,
Expand Down Expand Up @@ -48,7 +48,7 @@ final class EditSentenceInteractor: PresentableInteractor<EditSentencePresentabl

// MARK: - EditSentencePresentableListener

func nextButtonTapped() {
listener?.dismissEditSentence()
func saveButtonTapped(with text: String) {
listener?.dismissEditSentence(with: text)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import RxSwift
import UIKit

protocol EditSentencePresentableListener: AnyObject {
func nextButtonTapped()
func saveButtonTapped(with text: String)
}

final class EditSentenceViewController: UIViewController, EditSentencePresentable, EditSentenceViewControllable {
Expand Down Expand Up @@ -72,9 +72,9 @@ final class EditSentenceViewController: UIViewController, EditSentencePresentabl
return button
}()

private let nextButton: UIButton = {
private let saveButton: UIButton = {
let button = UIButton()
button.setTitle("다음", for: .normal)
button.setTitle("저장", for: .normal)
button.setTitleColor(.black, for: .normal)
button.backgroundColor = .particleColor.main
button.layer.cornerRadius = 8
Expand Down Expand Up @@ -149,9 +149,10 @@ final class EditSentenceViewController: UIViewController, EditSentencePresentabl
}
.disposed(by: disposeBag)

nextButton.rx.tap
saveButton.rx.tap
.bind { [weak self] in
self?.listener?.nextButtonTapped()
guard let self = self else { return }
self.listener?.saveButtonTapped(with: self.textView.text)
}
.disposed(by: disposeBag)

Expand Down Expand Up @@ -210,7 +211,7 @@ private extension EditSentenceViewController {
view.addSubview($0)
}

[refreshButton, nextButton].forEach {
[refreshButton, saveButton].forEach {
buttonStackView.addArrangedSubview($0)
}

Expand Down

0 comments on commit b07c41a

Please sign in to comment.