| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- RxSwift
- 직렬(Serial)
- popupView
- Control Event
- Multiple Cell Type
- NewsApp
- cocoapods
- Segmented Control
- Traits
- Swift Package Manager
- 비동기(Async)
- ios
- WeatherAPP
- pagination
- MVVM
- flatMap
- Transforming Operators
- Library
- MapKit
- Dispatch Queue
- IAMPopup
- SPM
- NSCache
- OpenSource
- 라이선스 저작권
- 의존성 관리 도구
- swift
- 동기(Sync)
- 동시(Concurrent)
- Rxcocoa
Archives
- Today
- Total
IAM iOS
[RxSwift] MVVM-C with Building Memo App (7) 메모 삭제 구현 본문
해당 포스팅은 KxCoding RxSwift 강의를 참고한 포스팅입니다!
https://www.youtube.com/watch?v=m41N4czHGF4&list=PLziSvys01Oek7ANk4rzOYobnUU_FTu5ns&index=2
메모 삭제 구현 (메모 보기 화면과 메모 목록 화면에서 모두 구현)
메모 보기 화면에서 삭제
MemoDetailViewModel
- 삭제 버튼과 Binding 할 Action 메서드 생성
- 메모를 삭제한 다음에 이전 화면으로 이동하도록 구현
class MemoDetailViewModel: CommonViewModel {
...
func makeDeleteAction() -> CocoaAction {
return Action { input in
self.storage.delete(memo: self.memo)
return self.sceneCoordinator.close(animated: true)
.asObservable().map { _ in }
}
}
}
MemoDetailViewController
deleteButton.rx.action = viewModel.makeDeleteAction()
보기 화면에서 삭제 결과 화면

메모 목록 화면에서 삭제
메모 목록 TableView에서 Swipe delete 모드를 활성화하고, 삭제 버튼과 Action을 Binding
MemoListViewModel
- 메서드 형태가 아닌 속성 형태로 구현
lazy var deleteAction: Action<Memo, Swift.Never> = {
return Action { memo in
return self.storage.delete(memo: memo).ignoreElements()
}
}()
MemoListViewController
- Swipe delete 모드를 활성화하고, 삭제 버튼과 Action을 Binding
- listTableView.rx.modelSelected(Memo.self)
- ControlEvent를 return → ControlEvent는 메모를 삭제할 때마다 next 이벤트를 방출
listTableView.rx.modelDeleted(Memo.self)
.bind(to: viewModel.deleteAction.inputs) /// ControlEvent를 delete 이벤트와 Binding
.disposed(by: rx.disposeBag)
목록 화면에서 삭제 결과 화면

GitHub - camosss/RxSwift: RxSwift 공부한 내용 정리
RxSwift 공부한 내용 정리. Contribute to camosss/RxSwift development by creating an account on GitHub.
github.com
[RxSwift] MVVM-C with Building Memo App (8) RxDataSources 적용
해당 포스팅은 KxCoding RxSwift 강의를 참고한 포스팅입니다! https://www.youtube.com/watch?v=m41N4czHGF4&list=PLziSvys01Oek7ANk4rzOYobnUU_FTu5ns&index=2 #9. RxDataSources 적용 메모가 삭제될 때 row 애..
llan.tistory.com
'RxSwift' 카테고리의 다른 글
| [RxSwift] MVVM-C with Building Memo App (8) RxDataSources 적용 (0) | 2022.05.12 |
|---|---|
| [RxSwift] MVVM-C with Building Memo App (6) 메모 편집 구현 (0) | 2022.05.12 |
| [RxSwift] MVVM-C with Building Memo App (5) 메모 보기 구현 (0) | 2022.05.12 |
| [RxSwift] MVVM-C with Building Memo App (4) 메모 쓰기 구현 (0) | 2022.05.12 |
| [RxSwift] MVVM-C with Building Memo App (3) 메모 목록 구현 (0) | 2022.05.12 |