Skip to content

Commit

Permalink
#27 Refactor: 코드 간격 수정, identifier cell 내부로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
zzisun committed May 11, 2021
1 parent 455768c commit e686769
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import RxSwift

class GameUsecase: UsecasePort {
private var games = [Game]()

private lazy var gameStorage = BehaviorSubject<[Game]>(value: games)
private var disposeBag = DisposeBag()

func appendGame(from data: Game) -> Observable<Game> {
games.append(data)
gameStorage.onNext(games)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Foundation
import RxSwift

protocol UsecasePort {

@discardableResult
func appendGame(from data: Game) -> Observable<Game>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import UIKit

enum Identifier {
static let GameCell = "GameCell"
}

class GameCell: UICollectionViewCell {
static let identifier = "GameCell"


@IBOutlet weak var gameIdLabel: UILabel!
@IBOutlet weak var homeTeamLabel: UILabel!
@IBOutlet weak var awayTeamLabel: UILabel!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class HomeViewController: UIViewController {
private func bindCollectionView() {
viewModel.getGameInfo()
viewModel.games
.bind(to: mainCollectionView.rx.items(cellIdentifier: Identifier.GameCell, cellType: GameCell.self)) {
.bind(to: mainCollectionView.rx.items(cellIdentifier: GameCell.identifier, cellType: GameCell.self)) {
row, game, cell in

cell.configureCell(game: game)
Expand Down

0 comments on commit e686769

Please sign in to comment.