diff --git a/Sources/View/MyPage/MyPageMenuTableViewCell.swift b/Sources/View/MyPage/MyPageMenuTableViewCell.swift index d71985d..10918a9 100644 --- a/Sources/View/MyPage/MyPageMenuTableViewCell.swift +++ b/Sources/View/MyPage/MyPageMenuTableViewCell.swift @@ -9,6 +9,8 @@ import UIKit import SnapKit import Then +import RxCocoa +import RxSwift class MyPageMenuTableViewCell: UITableViewCell { @@ -78,4 +80,8 @@ class MyPageMenuTableViewCell: UITableViewCell { $0.right.equalToSuperview().offset(-13) } } + + private func bind() { + + } } diff --git a/Sources/View/MyPage/MyPageViewController.swift b/Sources/View/MyPage/MyPageViewController.swift index 787df35..7238dbb 100644 --- a/Sources/View/MyPage/MyPageViewController.swift +++ b/Sources/View/MyPage/MyPageViewController.swift @@ -9,11 +9,17 @@ import UIKit import SnapKit import Then +import RxSwift +import RxCocoa +import KeychainSwift +import Loaf class MyPageViewController: UIViewController { private let viewModel = MyPageViewModel() + private let logOutButtonTapped = PublishSubject() + private lazy var profileImageView = UIImageView().then { $0.image = R.image.profileImage() } @@ -37,7 +43,7 @@ class MyPageViewController: UIViewController { setupSubview() setNavigationBar() } - + override func viewWillAppear(_ animated: Bool) { tabBarController?.tabBar.isHidden = false } @@ -142,8 +148,22 @@ extension MyPageViewController: UITableViewDelegate, UITableViewDataSource { navigationController?.pushViewController(LikedProductViewController(), animated: true) case [1, 1]: navigationController?.pushViewController(EditProfileViewController(), animated: true) + case [1, 2]: + KeychainSwift().delete("ACCESS-TOKEN") + Loaf( + "로그아웃되었습니다.", + state: .success, + location: .bottom, + presentingDirection: .vertical, + dismissingDirection: .vertical, + sender: self).show() + default: break } } + + private func bindViewModel() { + + } } diff --git a/Sources/ViewModel/MyPage/MyPageViewModel.swift b/Sources/ViewModel/MyPage/MyPageViewModel.swift index ff3a97c..1ffebd7 100644 --- a/Sources/ViewModel/MyPage/MyPageViewModel.swift +++ b/Sources/ViewModel/MyPage/MyPageViewModel.swift @@ -8,6 +8,8 @@ import Foundation import RxSwift +import RxCocoa +import KeychainSwift class MyPageViewModel: ViewModel { @@ -15,12 +17,22 @@ class MyPageViewModel: ViewModel { let output = Output() struct Input { + let logOutButtonIsTapped: Driver + let notificationSwitchIsOn: Driver } struct Output { + var logOutResult = PublishRelay() } func transform(_ input: Input) -> Output { + input.logOutButtonIsTapped.asObservable() + .subscribe( + onNext: { + KeychainSwift().delete("ACCESS-TOKEN") + } + ).disposed(by: disposeBag) + return output } }