Skip to content

Commit

Permalink
Merge pull request #16 from ghis22130/feature_tabbarcontroller
Browse files Browse the repository at this point in the history
feat: TabBarController 연결
  • Loading branch information
ghis22130 authored May 13, 2021
2 parents e62041d + 334d3f8 commit e5239c7
Show file tree
Hide file tree
Showing 12 changed files with 164 additions and 36 deletions.
36 changes: 34 additions & 2 deletions Baseball/Baseball.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
A09F9F3826491ECE00A78969 /* GameListDTO+Mapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = A09F9F3726491ECE00A78969 /* GameListDTO+Mapping.swift */; };
FF57667E2649324200F46A43 /* Alertable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF57667D2649324200F46A43 /* Alertable.swift */; };
FF576684264BA70A00F46A43 /* RunnerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF576683264BA70A00F46A43 /* RunnerView.swift */; };
FF576687264BCC2100F46A43 /* GameScoreViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF576686264BCC2100F46A43 /* GameScoreViewModel.swift */; };
FF57668B264BCE0C00F46A43 /* InGameTabBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF57668A264BCE0C00F46A43 /* InGameTabBarController.swift */; };
FFDD3A8C2641371C0037622A /* GameScoreHeader.xib in Resources */ = {isa = PBXBuildFile; fileRef = FFDD3A8B2641371C0037622A /* GameScoreHeader.xib */; };
FFDD3A90264138800037622A /* MatchUp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDD3A8F264138800037622A /* MatchUp.swift */; };
FFDD3A92264138F40037622A /* GameListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFDD3A91264138F40037622A /* GameListViewModel.swift */; };
Expand Down Expand Up @@ -74,6 +76,8 @@
A09F9F3726491ECE00A78969 /* GameListDTO+Mapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GameListDTO+Mapping.swift"; sourceTree = "<group>"; };
FF57667D2649324200F46A43 /* Alertable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Alertable.swift; sourceTree = "<group>"; };
FF576683264BA70A00F46A43 /* RunnerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = RunnerView.swift; path = Baseball/Presentation/Utils/RunnerView.swift; sourceTree = SOURCE_ROOT; };
FF576686264BCC2100F46A43 /* GameScoreViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = GameScoreViewModel.swift; path = Baseball/Presentation/Utils/GameScoreViewModel.swift; sourceTree = SOURCE_ROOT; };
FF57668A264BCE0C00F46A43 /* InGameTabBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InGameTabBarController.swift; sourceTree = "<group>"; };
FFDD3A8B2641371C0037622A /* GameScoreHeader.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GameScoreHeader.xib; sourceTree = "<group>"; };
FFDD3A8F264138800037622A /* MatchUp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchUp.swift; sourceTree = "<group>"; };
FFDD3A91264138F40037622A /* GameListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameListViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -124,6 +128,7 @@
A025C33D2640EC4D00C9B8C7 /* Presentation */ = {
isa = PBXGroup;
children = (
FF576689264BCDB300F46A43 /* TabBar */,
A05951C4264A2C02002B759A /* Flow */,
FF57667C2649323600F46A43 /* Utils */,
FFDD3A8A264137080037622A /* Common */,
Expand Down Expand Up @@ -222,8 +227,8 @@
A05951C7264A69C2002B759A /* GameScoreView */ = {
isa = PBXGroup;
children = (
A05951C8264A69F1002B759A /* GameScoreViewController.swift */,
A05951CD264A7921002B759A /* GameScoreTableViewCell.swift */,
FF576688264BCC3D00F46A43 /* View */,
FF576685264BCC1700F46A43 /* ViewModel */,
);
path = GameScoreView;
sourceTree = "<group>";
Expand Down Expand Up @@ -291,6 +296,31 @@
path = Utils;
sourceTree = "<group>";
};
FF576685264BCC1700F46A43 /* ViewModel */ = {
isa = PBXGroup;
children = (
FF576686264BCC2100F46A43 /* GameScoreViewModel.swift */,
);
path = ViewModel;
sourceTree = "<group>";
};
FF576688264BCC3D00F46A43 /* View */ = {
isa = PBXGroup;
children = (
A05951C8264A69F1002B759A /* GameScoreViewController.swift */,
A05951CD264A7921002B759A /* GameScoreTableViewCell.swift */,
);
path = View;
sourceTree = "<group>";
};
FF576689264BCDB300F46A43 /* TabBar */ = {
isa = PBXGroup;
children = (
FF57668A264BCE0C00F46A43 /* InGameTabBarController.swift */,
);
path = TabBar;
sourceTree = "<group>";
};
FFDD3A8A264137080037622A /* Common */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -394,6 +424,7 @@
A0907C2F264BB7F1007ABB1F /* GamePlayRepository.swift in Sources */,
A0907C37264BC1B1007ABB1F /* GamePlayViewModel.swift in Sources */,
FF57667E2649324200F46A43 /* Alertable.swift in Sources */,
FF576687264BCC2100F46A43 /* GameScoreViewModel.swift in Sources */,
FFDD3A92264138F40037622A /* GameListViewModel.swift in Sources */,
FFDD3A90264138800037622A /* MatchUp.swift in Sources */,
A05951C6264A2C18002B759A /* BaseballSceneFlowCoordinator.swift in Sources */,
Expand All @@ -413,6 +444,7 @@
A098D28C264383D700950F8F /* GamePlayViewController.swift in Sources */,
A09F9F3326490FC800A78969 /* NetworkService.swift in Sources */,
A09F9F352649102D00A78969 /* NetworkEndpoint.swift in Sources */,
FF57668B264BCE0C00F46A43 /* InGameTabBarController.swift in Sources */,
A025C3442640ED1C00C9B8C7 /* GameListCell.swift in Sources */,
FFDD3A9E2643C3960037622A /* PitchHistoryCell.swift in Sources */,
A05951BF264A27EC002B759A /* AppDIContainer.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ class BaseballSceneDIContainer: BaseballFlowCoordinatorDependencies {
return GamePlayViewController.create(with: makeGamePlayViewModel(matchId: matchId))
}

//MARK: - GameScoreView
private func makeGameScoreViewModel() -> GameScoreViewModel {
return GameScoreViewModel()
}
func makeGameScoreViewController() -> GameScoreViewController {
return GameScoreViewController.create(with: makeGameScoreViewModel())
}
//MARK: - Coordinator
func makeBaseballSceneCoordinator(navigationController: UINavigationController) -> BaseballSceneFlowCoordinator {
return BaseballSceneFlowCoordinator(navigationController: navigationController, dependencies: self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import UIKit
protocol BaseballFlowCoordinatorDependencies {
func makeGameListViewController(action: GameListViewModelAction) -> GameListViewController
func makeGamePlayViewController(matchId: Int) -> GamePlayViewController
func makeGameScoreViewController() -> GameScoreViewController
}

class BaseballSceneFlowCoordinator {
Expand All @@ -31,7 +32,10 @@ class BaseballSceneFlowCoordinator {

// let showGamePlayView: ((Int)-> Void)
func showGamePlayView(matchUp: Int) {
let vc = dependencies.makeGamePlayViewController(matchId: matchUp)
self.navigationController?.pushViewController(vc, animated: true)
let playVC = dependencies.makeGamePlayViewController(matchId: matchUp)
let scoreVC = dependencies.makeGameScoreViewController()

let tabBarVC = InGameTabBarController.create(playVC: playVC, scoreVC: scoreVC)
self.navigationController?.present(tabBarVC, animated: true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ class GameScoreViewController: UIViewController {
@IBOutlet weak var awayTeamScore: UIStackView!
@IBOutlet weak var gameScoreTableView: UITableView!

private var viewModel: GameScoreViewModel!

static let storyboardName = "Main"
static let storyboardID = "GameScoreViewController"

static func create(with viewModel: GameScoreViewModel) -> GameScoreViewController {
let storyboard = UIStoryboard(name: storyboardName, bundle: Bundle.main)
guard let vc = storyboard.instantiateViewController(identifier: storyboardID) as? GameScoreViewController else {
return GameScoreViewController()
}
vc.viewModel = viewModel
return vc
}

override func viewDidLoad() {
super.viewDidLoad()
configureStackView()
Expand Down
34 changes: 34 additions & 0 deletions Baseball/Baseball/Presentation/TabBar/InGameTabBarController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// InGameTabBarController.swift
// Baseball
//
// Created by 지북 on 2021/05/12.
//

import UIKit

class InGameTabBarController: UITabBarController {

static let storyboardName = "Main"
static let storyboardID = "InGameTabBarController"

static func create(playVC: GamePlayViewController, scoreVC: GameScoreViewController) -> InGameTabBarController {
let storyboard = UIStoryboard(name: storyboardName, bundle: Bundle.main)
guard let vc = storyboard.instantiateViewController(identifier: storyboardID) as? InGameTabBarController else {
return InGameTabBarController()
}

let playViewBarItem = UITabBarItem(title: "playView", image: UIImage(named: "baseball-player.png"), selectedImage: UIImage(named: "baseball-player.png"))
let scoreViewBarItem = UITabBarItem(title: "scoreView", image: UIImage(named: "analytics.png"), selectedImage: UIImage(named: "analytics.png"))

playVC.tabBarItem = playViewBarItem
scoreVC.tabBarItem = scoreViewBarItem

vc.viewControllers = [playVC, scoreVC]
return vc
}

override func viewDidLoad() {
super.viewDidLoad()
}
}
12 changes: 12 additions & 0 deletions Baseball/Baseball/Presentation/Utils/GameScoreViewModel.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// GameScoreViewModel.swift
// Baseball
//
// Created by 지북 on 2021/05/12.
//

import Foundation

class GameScoreViewModel {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "analytics.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "baseball-player.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e5239c7

Please sign in to comment.