Skip to content

Commit

Permalink
Merge pull request #144 from OMZigak/refactor/#143-trimming-models
Browse files Browse the repository at this point in the history
[refactor] ModelType 프로토콜 선언 및 실제 모델들 재정의
  • Loading branch information
JinUng41 authored Jul 8, 2024
2 parents c07e1a8 + 1cf6edf commit c2fe9e4
Show file tree
Hide file tree
Showing 27 changed files with 87 additions and 48 deletions.
28 changes: 22 additions & 6 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
DE9E188B2C3BC92500DB76B4 /* EmptyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9E188A2C3BC92500DB76B4 /* EmptyModel.swift */; };
DE9E18922C3BCC9D00DB76B4 /* SocialLoginRequestModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9E18912C3BCC9D00DB76B4 /* SocialLoginRequestModel.swift */; };
DE9E189A2C3BCCBE00DB76B4 /* UtilsTemp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE9E18992C3BCCBE00DB76B4 /* UtilsTemp.swift */; };
DEBA032F2C3C24F2002ED8F2 /* ModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBA032E2C3C24F2002ED8F2 /* ModelType.swift */; };
DEBA03312C3C2972002ED8F2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEBA03302C3C2972002ED8F2 /* ViewController.swift */; };
DED5DBEC2C345210006ECE7E /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5DBEB2C345210006ECE7E /* BaseViewController.swift */; };
DED5DBEE2C34529A006ECE7E /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5DBED2C34529A006ECE7E /* BaseView.swift */; };
DED5DBF02C345317006ECE7E /* BaseCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DED5DBEF2C345317006ECE7E /* BaseCollectionViewCell.swift */; };
Expand Down Expand Up @@ -166,6 +168,8 @@
DE9E188A2C3BC92500DB76B4 /* EmptyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyModel.swift; sourceTree = "<group>"; };
DE9E18912C3BCC9D00DB76B4 /* SocialLoginRequestModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialLoginRequestModel.swift; sourceTree = "<group>"; };
DE9E18992C3BCCBE00DB76B4 /* UtilsTemp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UtilsTemp.swift; sourceTree = "<group>"; };
DEBA032E2C3C24F2002ED8F2 /* ModelType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelType.swift; sourceTree = "<group>"; };
DEBA03302C3C2972002ED8F2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
DED5DBEB2C345210006ECE7E /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
DED5DBED2C34529A006ECE7E /* BaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
DED5DBEF2C345317006ECE7E /* BaseCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseCollectionViewCell.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -319,12 +323,13 @@
DE254AA32C31107C00A4015E /* Resource */ = {
isa = PBXGroup;
children = (
DEBA03302C3C2972002ED8F2 /* ViewController.swift */,
DE254AA42C31131600A4015E /* Color.xcassets */,
78B928742C29402E006D9942 /* Assets.xcassets */,
78B928762C29402E006D9942 /* LaunchScreen.storyboard */,
785AE1D02C3B07A600677CA0 /* PrivacyInfo.plist */,
78B928792C29402E006D9942 /* Info.plist */,
DE9E187E2C3BA49B00DB76B4 /* Components */,
DE9E187E2C3BA49B00DB76B4 /* Component */,
DE8247FE2C36E846000601BC /* ObservablePattern */,
DED5DBEA2C345202006ECE7E /* Base */,
DE254AA62C3118B300A4015E /* Extension */,
Expand Down Expand Up @@ -390,35 +395,36 @@
path = ObservablePattern;
sourceTree = "<group>";
};
DE9E187E2C3BA49B00DB76B4 /* Components */ = {
DE9E187E2C3BA49B00DB76B4 /* Component */ = {
isa = PBXGroup;
children = (
DE9E187F2C3BA4AA00DB76B4 /* CustomButton.swift */,
DE9E18832C3BA84500DB76B4 /* CustomTextField.swift */,
);
path = Components;
path = Component;
sourceTree = "<group>";
};
DE9E18852C3BC8F000DB76B4 /* DTO */ = {
isa = PBXGroup;
children = (
DE9E18872C3BC90300DB76B4 /* Model */,
DE9E18862C3BC8F900DB76B4 /* Response */,
DE9E18862C3BC8F900DB76B4 /* ResponseBody */,
);
path = DTO;
sourceTree = "<group>";
};
DE9E18862C3BC8F900DB76B4 /* Response */ = {
DE9E18862C3BC8F900DB76B4 /* ResponseBody */ = {
isa = PBXGroup;
children = (
DE9E18882C3BC91000DB76B4 /* ResponseBodyDTO.swift */,
);
path = Response;
path = ResponseBody;
sourceTree = "<group>";
};
DE9E18872C3BC90300DB76B4 /* Model */ = {
isa = PBXGroup;
children = (
DEBA032D2C3C24E9002ED8F2 /* Protocol */,
DE9E189B2C3BCCC600DB76B4 /* Empty */,
DE9E188D2C3BCC6100DB76B4 /* Auth */,
DE9E188C2C3BCC3E00DB76B4 /* Users */,
Expand Down Expand Up @@ -493,6 +499,14 @@
path = Empty;
sourceTree = "<group>";
};
DEBA032D2C3C24E9002ED8F2 /* Protocol */ = {
isa = PBXGroup;
children = (
DEBA032E2C3C24F2002ED8F2 /* ModelType.swift */,
);
path = Protocol;
sourceTree = "<group>";
};
DED5DBEA2C345202006ECE7E /* Base */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -641,6 +655,7 @@
DE9E188B2C3BC92500DB76B4 /* EmptyModel.swift in Sources */,
DDA2EE732C385EB9007C6059 /* MainTabBarController.swift in Sources */,
A3FB184D2C3BF45F001483E5 /* MakeMeetingsRequestModel.swift in Sources */,
DEBA03312C3C2972002ED8F2 /* ViewController.swift in Sources */,
DD865B642C3920F000C351A2 /* AppleLoginVC.swift in Sources */,
A3FB18592C3BF77D001483E5 /* MeetingInfoResponseModel.swift in Sources */,
DE9E18842C3BA84500DB76B4 /* CustomTextField.swift in Sources */,
Expand All @@ -663,6 +678,7 @@
DE254AB22C31197B00A4015E /* UIButton+.swift in Sources */,
DDA2EE772C385FC3007C6059 /* GroupListViewController.swift in Sources */,
78B9286C2C29402C006D9942 /* AppDelegate.swift in Sources */,
DEBA032F2C3C24F2002ED8F2 /* ModelType.swift in Sources */,
789AD4B52C3C0147002E2688 /* ResissueResponseModel.swift in Sources */,
DED5DBF42C34539A006ECE7E /* BaseTableViewCell.swift in Sources */,
78B9286E2C29402C006D9942 /* SceneDelegate.swift in Sources */,
Expand Down
5 changes: 1 addition & 4 deletions KkuMulKum/Network/DTO/Model/Auth/ResissueResponseModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import Foundation


// MARK: - ReissueResponseModel

struct ReissueResponseModel: Codable {
struct ReissueModel: ResponseModelType {
let accessToken, refreshToken: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import Foundation


// MARK: - SocialLoginRequestModel

struct SocialLoginRequestModel: Codable {
struct SocialLoginRequestModel: RequestModelType {
let provider: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

import Foundation


// MARK: - SocialLoginResponseModel

struct SocialLoginResponseModel: Codable {
struct SocialLoginResponseModel: ResponseModelType {
let name, accessToken, refreshToken: String?
}
2 changes: 1 addition & 1 deletion KkuMulKum/Network/DTO/Model/Empty/EmptyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

import Foundation

struct EmptyModel: Codable {}
struct EmptyModel: RequestModelType, ResponseModelType {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

import Foundation

struct MakeMeetingsRequestModel: Codable {
struct MakeMeetingsRequestModel: RequestModelType {
let name: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

import Foundation

struct MakeMeetingsResponseModel: Codable {
struct MakeMeetingsResponseModel: ResponseModelType {
let invitationCode: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct MeetingInfoResponseModel: Codable {
struct MeetingInfoModel: ResponseModelType {
let id: Int
let name, createdAt: String
let metCount: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct MeetingListResponseModel: Codable {
struct MeetingListModel: ResponseModelType {
let count: Int
let meetings: [Meeting]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct MeetingMembersResponseModel: Codable {
struct MeetingMembersModel: ResponseModelType {
let memberCount: Int
let members: [Member]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

import Foundation

struct RegisterMeetingsRequestModel: Codable {
let name: String
struct RegisterMeetingsModel: RequestModelType {
let invitationCode: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation

struct AddPromiseRequestModel: Codable {
struct AddPromiseModel: RequestModelType {
let name, placeName, x, y, address, roadAddress, time, dressUpLevel, penalty: String
let id: Int
let participants: [Int]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// Created by YOUJIM on 7/8/24.
//

import Foundation


// MARK: 도착 완료 업데이트
// TODO: 서버에서 정확한 API 맞는지 답변 필요 (질문해둠)

import Foundation

struct ArrivalCompletionResponseModel: Codable {
struct ArrivalCompletionModel: ResponseModelType {
let name, profileImageURL: String
let level, promiseCount, tardyCount, tardySum: Int

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Created by YOUJIM on 7/8/24.
//

import Foundation

// MARK: 내 약속 준비 정보 입력

import Foundation
// MARK: 내 약속 준비 정보 입력

struct MyPromiseReadyInfoRequestModel: Codable {
struct MyPromiseReadyInfoModel: RequestModelType {
let preparationTime, travelTime: Int
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation

struct MyReadyStatusResponseModel: Codable {
struct MyReadyStatusModel: ResponseModelType {
let preparationTime, travelTime: Int
let preparationStartAt, departureAt, arrivalAt: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by YOUJIM on 7/8/24.
//

import Foundation

// MARK: 오늘 가장 가까운 약속 조회 (1개)

import Foundation
// MARK: 오늘 가장 가까운 약속 조회 (1개)

struct NearestPromiseResponseModel: Codable {
struct NearestPromiseModel: ResponseModelType {
let id, dDay: Int
let name, meetingName, dressUpLevel, date, time, placeName: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@

import Foundation

struct PromiseInfoResponseModel: Codable {
struct PromiseInfoModel: ResponseModelType {
let placeName, address, roadAddress, time, dressUpLevel, penalty: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation

struct PromiseLateInfoResponseModel: Codable {
struct PromiseLateInfoModel: ResponseModelType {
let penalty, name, profileImageURL: String
let isPastDue: Bool
let lateComers: [Comer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@
// Created by YOUJIM on 7/8/24.
//

import Foundation

// MARK: 약속 참여자 목록

import Foundation
// MARK: 약속 참여자 목록

struct PromiseParticipantListResponseModel: Codable {
struct PromiseParticipantListModel: ResponseModelType {
let participants: [Participant]
}

struct Participant: Codable {
let id: Int
let name, profileImage, state: String
let name, profileImageURL, state: String

enum CodingKeys: String, CodingKey {
case id
case name
case profileImage = "profileImg"
case profileImageURL = "profileImg"
case state
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import Foundation

struct UpcomingPromiseListResponseModel: Codable {
struct UpcomingPromiseListModel: ResponseModelType {
let promises: [UpcomingPromise]
}

Expand Down
14 changes: 14 additions & 0 deletions KkuMulKum/Network/DTO/Model/Protocol/ModelType.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// ModelType.swift
// KkuMulKum
//
// Created by 김진웅 on 7/8/24.
//

import Foundation

/// Request 시, 사용할 프로토콜
protocol RequestModelType: Codable {}

/// Response 시, 사용할 프로토콜
protocol ResponseModelType: Codable {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct LoginUserResponseModel: Codable {
struct LoginUserModel: ResponseModelType {
let name: String
let level: Int
let promiseCount: Int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

import Foundation

struct UpdateProfileNameModel: Codable {
struct UpdateProfileNameModel: RequestModelType, ResponseModelType {
let name: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

/// 제네릭 ResponseBody 구조체 정의
struct ResponseBodyDTO<T: Codable>: Codable {
struct ResponseBodyDTO<T: ResponseModelType>: Codable {
let data: T?
let error: ErrorResponse?
}
Expand Down
18 changes: 18 additions & 0 deletions KkuMulKum/Resource/ViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ViewController.swift
// KkuMulKum
//
// Created by 김진웅 on 7/8/24.
//

import UIKit

final class ViewController: BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
}

override func setupView() {
view.backgroundColor = .systemBackground
}
}

0 comments on commit c2fe9e4

Please sign in to comment.