Skip to content

Commit

Permalink
Merge pull request #47 from leeari95/release/v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leeari95 authored Aug 20, 2022
2 parents dd22e2d + 8c76121 commit f4f2e35
Show file tree
Hide file tree
Showing 1,219 changed files with 3,537 additions and 2,586 deletions.
4 changes: 2 additions & 2 deletions Animal-Crossing-Wiki/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
included:
- Animal-Crossing-Wiki # 프로젝트 이름
excluded: # 린트 과정에서 무시할 파일 경로. `included`보다 우선순위 높음
- Animal-Crossing-Wiki/AppDelegate.swift
- Animal-Crossing-Wiki/SceneDelegate.swift
- Animal-Crossing-Wiki/Resources/AppDelegate.swift
- Animal-Crossing-Wiki/Resources/SceneDelegate.swift
type_body_length: # 타입 길이
warning: 200
error: 250
Expand Down
269 changes: 160 additions & 109 deletions Animal-Crossing-Wiki/Animal-Crossing-Wiki.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ final class CatalogCoordinator: Coordinator {

func start() {
let catalogVC = CatalogViewController()
catalogVC.bind(to: CatalogViewModel(coordinator: self))
catalogVC.bind(to: CatalogReactor(coordinator: self))
rootViewController.addChild(catalogVC)
}

func transition(for route: Route) {
switch route {
case .items(let category):
let viewController = ItemsViewController()
viewController.bind(to: ItemsViewModel(category: category, coordinator: self))
viewController.bind(to: ItemsReactor(category: category, coordinator: self))
rootViewController.pushViewController(viewController, animated: true)
case .itemDetail(let item):
let viewController = ItemDetailViewController()
viewController.bind(to: ItemDetailViewModel(item: item, coordinator: self))
viewController.bind(to: ItemDetailReactor(item: item, coordinator: self))
rootViewController.pushViewController(viewController, animated: true)
case .keyword(let title, let keyword):
let viewController = ItemsViewController()
viewController.bind(to: ItemsViewModel(coordinator: self, mode: .keyword(title: title, category: keyword)))
viewController.bind(to: ItemsReactor(coordinator: self, mode: .keyword(title: title, category: keyword)))
rootViewController.pushViewController(viewController, animated: true)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,29 @@ class CatalogViewController: UIViewController {
])
}

func bind(to viewModel: CatalogViewModel) {
let input = CatalogViewModel.Input(
selectedCategory: tableView.rx.modelSelected((title: Category, count: Int).self).asObservable()
)
let output = viewModel.transform(input: input, disposeBag: disposeBag)
func bind(to reactor: CatalogReactor) {
self.rx.viewDidLoad
.map { CatalogReactor.Action.fetch }
.subscribe(onNext: { action in
reactor.action.onNext(action)
}).disposed(by: disposeBag)

tableView.rx.modelSelected((title: Category, count: Int).self)
.map { CatalogReactor.Action.selectedCategory(title: $0.0) }
.bind(to: reactor.action)
.disposed(by: disposeBag)

reactor.state.map { $0.isLoading }
.bind(to: activityIndicator.rx.isAnimating)
.disposed(by: disposeBag)

output.catagories
reactor.state.map { $0.categories }
.bind(to: tableView.rx.items(cellIdentifier: CategoryRow.className, cellType: CategoryRow.self)) { _, item, cell in
cell.setUp(
iconName: item.title.iconName,
title: item.title.rawValue.localized,
itemCount: item.count
)
}.disposed(by: disposeBag)

tableView.rx.itemSelected
.withUnretained(self)
.subscribe(onNext: { owner, indexPath in
owner.tableView.deselectRow(at: indexPath, animated: true)
}).disposed(by: disposeBag)

output.isLoading
.bind(to: self.activityIndicator.rx.isAnimating)
.disposed(by: disposeBag)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,36 @@ class ItemDetailViewController: UIViewController {
navigationItem.enableMultilineTitle()
}

func bind(to viewModel: ItemDetailViewModel) {
keywordView = ItemKeywordView(item: viewModel.item)
func bind(to reactor: ItemDetailReactor) {
keywordView = ItemKeywordView(item: reactor.currentState.item)
playerView = ItemPlayerView()
navigationItem.title = viewModel.item.translations.localizedName()
setUpSection(in: viewModel.item)
navigationItem.title = reactor.currentState.item.translations.localizedName()
setUpSection(in: reactor.currentState.item)

let input = ItemDetailViewModel.Input(
didTapCheck: checkButton.rx.tap.asObservable(),
didTapKeyword: keywordView?.didTapKeyword,
didTapPlay: playerView?.playButton.rx.tap.asObservable()
)
let output = viewModel.transform(input: input, disposeBag: disposeBag)
self.rx.viewDidLoad
.map { ItemDetailReactor.Action.fetch }
.subscribe(onNext: { action in
reactor.action.onNext(action)
}).disposed(by: disposeBag)

output.isAcquired
checkButton.rx.tap
.map { ItemDetailReactor.Action.check }
.bind(to: reactor.action)
.disposed(by: disposeBag)

keywordView?.didTapKeyword
.compactMap { $0 }
.map { ItemDetailReactor.Action.didTapKeyword($0) }
.subscribe(onNext: { action in
reactor.action.onNext(action)
}).disposed(by: disposeBag)

playerView?.playButton.rx.tap
.map { ItemDetailReactor.Action.play }
.bind(to: reactor.action)
.disposed(by: disposeBag)

reactor.state.map { $0.isAcquired }
.observe(on: MainScheduler.instance)
.withUnretained(self)
.subscribe(onNext: { owner, isAcquired in
Expand Down Expand Up @@ -106,6 +122,7 @@ class ItemDetailViewController: UIViewController {
setUpSaeson(item)
setUpKeyword(item)
setUpMaterials(item)
setUpPlayer(item)
}

private func setUpDetail(_ item: Item) {
Expand Down
Loading

0 comments on commit f4f2e35

Please sign in to comment.