diff --git a/iOS/Baseball/Baseball.xcodeproj/project.pbxproj b/iOS/Baseball/Baseball.xcodeproj/project.pbxproj index e870691e5..beaefc923 100644 --- a/iOS/Baseball/Baseball.xcodeproj/project.pbxproj +++ b/iOS/Baseball/Baseball.xcodeproj/project.pbxproj @@ -7,9 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + BD8A23742643C4E400828432 /* DTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8A23732643C4E400828432 /* DTO.swift */; }; D4A2CB682640E4FD0019AFB6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */; }; D4A2CB6A2640E4FD0019AFB6 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */; }; - D4A2CB6C2640E4FD0019AFB6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB6B2640E4FD0019AFB6 /* ViewController.swift */; }; + D4A2CB6C2640E4FD0019AFB6 /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */; }; D4A2CB6F2640E4FD0019AFB6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D4A2CB6D2640E4FD0019AFB6 /* Main.storyboard */; }; D4A2CB712640E4FF0019AFB6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D4A2CB702640E4FF0019AFB6 /* Assets.xcassets */; }; D4A2CB742640E4FF0019AFB6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D4A2CB722640E4FF0019AFB6 /* LaunchScreen.storyboard */; }; @@ -38,10 +39,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + BD8A23732643C4E400828432 /* DTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DTO.swift; sourceTree = ""; }; D4A2CB642640E4FD0019AFB6 /* Baseball.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Baseball.app; sourceTree = BUILT_PRODUCTS_DIR; }; D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; - D4A2CB6B2640E4FD0019AFB6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = ""; }; D4A2CB6E2640E4FD0019AFB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; D4A2CB702640E4FF0019AFB6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; D4A2CB732640E4FF0019AFB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -82,6 +84,49 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + BD8A236F2643C42800828432 /* Controller */ = { + isa = PBXGroup; + children = ( + D4A2CBA7264382B00019AFB6 /* ScoresViewController.swift */, + D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; + BD8A23702643C47200828432 /* View */ = { + isa = PBXGroup; + children = ( + D4A2CB9A2640E5E60019AFB6 /* GameListCell.swift */, + D4A2CB9B2640E5E60019AFB6 /* GameListCell.xib */, + ); + path = View; + sourceTree = ""; + }; + BD8A23712643C47C00828432 /* Model */ = { + isa = PBXGroup; + children = ( + BD8A23752643C5F300828432 /* Network */, + ); + path = Model; + sourceTree = ""; + }; + BD8A23722643C48400828432 /* LifeCycle */ = { + isa = PBXGroup; + children = ( + D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */, + D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */, + ); + path = LifeCycle; + sourceTree = ""; + }; + BD8A23752643C5F300828432 /* Network */ = { + isa = PBXGroup; + children = ( + BD8A23732643C4E400828432 /* DTO.swift */, + ); + path = Network; + sourceTree = ""; + }; D4A2CB5B2640E4FD0019AFB6 = { isa = PBXGroup; children = ( @@ -105,13 +150,11 @@ D4A2CB662640E4FD0019AFB6 /* Baseball */ = { isa = PBXGroup; children = ( - D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */, - D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */, - D4A2CB6B2640E4FD0019AFB6 /* ViewController.swift */, + BD8A23722643C48400828432 /* LifeCycle */, + BD8A23712643C47C00828432 /* Model */, + BD8A23702643C47200828432 /* View */, + BD8A236F2643C42800828432 /* Controller */, D4A2CB6D2640E4FD0019AFB6 /* Main.storyboard */, - D4A2CBA7264382B00019AFB6 /* ScoresViewController.swift */, - D4A2CB9A2640E5E60019AFB6 /* GameListCell.swift */, - D4A2CB9B2640E5E60019AFB6 /* GameListCell.xib */, D4A2CB702640E4FF0019AFB6 /* Assets.xcassets */, D4A2CB722640E4FF0019AFB6 /* LaunchScreen.storyboard */, D4A2CB752640E4FF0019AFB6 /* Info.plist */, @@ -268,9 +311,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - D4A2CB6C2640E4FD0019AFB6 /* ViewController.swift in Sources */, + D4A2CB6C2640E4FD0019AFB6 /* MainViewController.swift in Sources */, D4A2CBA8264382B00019AFB6 /* ScoresViewController.swift in Sources */, D4A2CB682640E4FD0019AFB6 /* AppDelegate.swift in Sources */, + BD8A23742643C4E400828432 /* DTO.swift in Sources */, D4A2CB6A2640E4FD0019AFB6 /* SceneDelegate.swift in Sources */, D4A2CB9C2640E5E60019AFB6 /* GameListCell.swift in Sources */, ); diff --git a/iOS/Baseball/Baseball/Base.lproj/Main.storyboard b/iOS/Baseball/Baseball/Base.lproj/Main.storyboard index 1074f68ae..d4379bb4b 100644 --- a/iOS/Baseball/Baseball/Base.lproj/Main.storyboard +++ b/iOS/Baseball/Baseball/Base.lproj/Main.storyboard @@ -9,10 +9,10 @@ - + - + diff --git a/iOS/Baseball/Baseball/ViewController.swift b/iOS/Baseball/Baseball/Controller/MainViewController.swift similarity index 86% rename from iOS/Baseball/Baseball/ViewController.swift rename to iOS/Baseball/Baseball/Controller/MainViewController.swift index b1123b51d..153108b97 100644 --- a/iOS/Baseball/Baseball/ViewController.swift +++ b/iOS/Baseball/Baseball/Controller/MainViewController.swift @@ -7,7 +7,7 @@ import UIKit -class ViewController: UIViewController { +class MainViewController: UIViewController { @IBOutlet weak var gameListCollectionView: UICollectionView! override func viewDidLoad() { @@ -18,7 +18,7 @@ class ViewController: UIViewController { } } -extension ViewController: UICollectionViewDataSource { +extension MainViewController: UICollectionViewDataSource { func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return 4 } @@ -32,7 +32,7 @@ extension ViewController: UICollectionViewDataSource { } } -extension ViewController: UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { +extension MainViewController: UICollectionViewDelegate, UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let width = collectionView.bounds.width - 10 let height = (collectionView.bounds.height) / 5 - 10 diff --git a/iOS/Baseball/Baseball/ScoresViewController.swift b/iOS/Baseball/Baseball/Controller/ScoresViewController.swift similarity index 100% rename from iOS/Baseball/Baseball/ScoresViewController.swift rename to iOS/Baseball/Baseball/Controller/ScoresViewController.swift diff --git a/iOS/Baseball/Baseball/AppDelegate.swift b/iOS/Baseball/Baseball/LifeCycle/AppDelegate.swift similarity index 100% rename from iOS/Baseball/Baseball/AppDelegate.swift rename to iOS/Baseball/Baseball/LifeCycle/AppDelegate.swift diff --git a/iOS/Baseball/Baseball/SceneDelegate.swift b/iOS/Baseball/Baseball/LifeCycle/SceneDelegate.swift similarity index 100% rename from iOS/Baseball/Baseball/SceneDelegate.swift rename to iOS/Baseball/Baseball/LifeCycle/SceneDelegate.swift diff --git a/iOS/Baseball/Baseball/Model/Network/DTO.swift b/iOS/Baseball/Baseball/Model/Network/DTO.swift new file mode 100644 index 000000000..f5a5c79cc --- /dev/null +++ b/iOS/Baseball/Baseball/Model/Network/DTO.swift @@ -0,0 +1,47 @@ + + +import Foundation + +struct GameList { + var games: [Game] +} + +struct Game { + var home: Team + var away: Team + var homeScore: Int + var awayScore: Int + var inning: Int // 몇회 + var status: String // 초, 말 + var ballCount: [BallCount] +} + +struct Team { + var name: String + var players: [Player] +} + +struct Player { + var name: String + var position: String // 포지션 + var atBat: String // 타석 + var hits: Int // 안타 + var out: Int // 아웃 + var battingAverage: Double // 타율 + var numberOfPitches: Int // 투구수 +} + +struct BallCount { + enum ball: Int { + case strike = 0 + case ball = 1 + case hit = 2 + } + var ballCount: [ball] + var hit: Bool +} + +struct Score { + var home: [Int] + var away: [Int] +} diff --git a/iOS/Baseball/Baseball/GameListCell.swift b/iOS/Baseball/Baseball/View/GameListCell.swift similarity index 100% rename from iOS/Baseball/Baseball/GameListCell.swift rename to iOS/Baseball/Baseball/View/GameListCell.swift diff --git a/iOS/Baseball/Baseball/GameListCell.xib b/iOS/Baseball/Baseball/View/GameListCell.xib similarity index 100% rename from iOS/Baseball/Baseball/GameListCell.xib rename to iOS/Baseball/Baseball/View/GameListCell.xib