Skip to content

Commit

Permalink
[#6] feat: Create DTO
Browse files Browse the repository at this point in the history
DTO 생성
  • Loading branch information
Sonjh1306 committed May 6, 2021
1 parent ddd3093 commit fcb2c0b
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 14 deletions.
62 changes: 53 additions & 9 deletions iOS/Baseball/Baseball.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -38,10 +39,11 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
BD8A23732643C4E400828432 /* DTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DTO.swift; sourceTree = "<group>"; };
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 = "<group>"; };
D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
D4A2CB6B2640E4FD0019AFB6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
D4A2CB6E2640E4FD0019AFB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
D4A2CB702640E4FF0019AFB6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
D4A2CB732640E4FF0019AFB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -82,6 +84,49 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
BD8A236F2643C42800828432 /* Controller */ = {
isa = PBXGroup;
children = (
D4A2CBA7264382B00019AFB6 /* ScoresViewController.swift */,
D4A2CB6B2640E4FD0019AFB6 /* MainViewController.swift */,
);
path = Controller;
sourceTree = "<group>";
};
BD8A23702643C47200828432 /* View */ = {
isa = PBXGroup;
children = (
D4A2CB9A2640E5E60019AFB6 /* GameListCell.swift */,
D4A2CB9B2640E5E60019AFB6 /* GameListCell.xib */,
);
path = View;
sourceTree = "<group>";
};
BD8A23712643C47C00828432 /* Model */ = {
isa = PBXGroup;
children = (
BD8A23752643C5F300828432 /* Network */,
);
path = Model;
sourceTree = "<group>";
};
BD8A23722643C48400828432 /* LifeCycle */ = {
isa = PBXGroup;
children = (
D4A2CB672640E4FD0019AFB6 /* AppDelegate.swift */,
D4A2CB692640E4FD0019AFB6 /* SceneDelegate.swift */,
);
path = LifeCycle;
sourceTree = "<group>";
};
BD8A23752643C5F300828432 /* Network */ = {
isa = PBXGroup;
children = (
BD8A23732643C4E400828432 /* DTO.swift */,
);
path = Network;
sourceTree = "<group>";
};
D4A2CB5B2640E4FD0019AFB6 = {
isa = PBXGroup;
children = (
Expand All @@ -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 */,
Expand Down Expand Up @@ -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 */,
);
Expand Down
4 changes: 2 additions & 2 deletions iOS/Baseball/Baseball/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<!--Main View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Baseball" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="MainViewController" customModule="Baseball" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="390" height="844"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import UIKit

class ViewController: UIViewController {
class MainViewController: UIViewController {
@IBOutlet weak var gameListCollectionView: UICollectionView!

override func viewDidLoad() {
Expand All @@ -18,7 +18,7 @@ class ViewController: UIViewController {
}
}

extension ViewController: UICollectionViewDataSource {
extension MainViewController: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 4
}
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions iOS/Baseball/Baseball/Model/Network/DTO.swift
Original file line number Diff line number Diff line change
@@ -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]
}
File renamed without changes.
File renamed without changes.

0 comments on commit fcb2c0b

Please sign in to comment.