Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

12/21 투두리스트 PR #13

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
26 changes: 20 additions & 6 deletions DaeHyun/ToDoListApp/ToDoListApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
A63437172B14F31000A717C2 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63437162B14F31000A717C2 /* Task.swift */; };
A63437172B14F31000A717C2 /* Todo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63437162B14F31000A717C2 /* Todo.swift */; };
A634371A2B17275000A717C2 /* CombineMoya in Frameworks */ = {isa = PBXBuildFile; productRef = A63437192B17275000A717C2 /* CombineMoya */; };
A634371C2B17275000A717C2 /* Moya in Frameworks */ = {isa = PBXBuildFile; productRef = A634371B2B17275000A717C2 /* Moya */; };
A634371E2B17275000A717C2 /* ReactiveMoya in Frameworks */ = {isa = PBXBuildFile; productRef = A634371D2B17275000A717C2 /* ReactiveMoya */; };
Expand All @@ -16,6 +16,9 @@
A63437262B1755FA00A717C2 /* TodoResponseDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63437252B1755FA00A717C2 /* TodoResponseDTO.swift */; };
A63437282B17945300A717C2 /* Date+.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63437272B17945300A717C2 /* Date+.swift */; };
A634372A2B17A41400A717C2 /* TodoRequestDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63437292B17A41400A717C2 /* TodoRequestDTO.swift */; };
A6AB519C2B328BEF00C94A7F /* TaskDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AB519B2B328BEF00C94A7F /* TaskDetailViewController.swift */; };
A6AB519E2B32D4E500C94A7F /* MoyaProvider+.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AB519D2B32D4E500C94A7F /* MoyaProvider+.swift */; };
A6AB51A02B32F4B500C94A7F /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6AB519F2B32F4B500C94A7F /* LoginViewController.swift */; };
A6B2AFFE2AFB96A80070A772 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6B2AFFD2AFB96A80070A772 /* AppDelegate.swift */; };
A6B2B0002AFB96A80070A772 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6B2AFFF2AFB96A80070A772 /* SceneDelegate.swift */; };
A6B2B0072AFB96A90070A772 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A6B2B0062AFB96A90070A772 /* Assets.xcassets */; };
Expand All @@ -31,11 +34,14 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
A63437162B14F31000A717C2 /* Task.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Task.swift; sourceTree = "<group>"; };
A63437162B14F31000A717C2 /* Todo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Todo.swift; sourceTree = "<group>"; };
A63437212B17276C00A717C2 /* TodoAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoAPI.swift; sourceTree = "<group>"; };
A63437252B1755FA00A717C2 /* TodoResponseDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoResponseDTO.swift; sourceTree = "<group>"; };
A63437272B17945300A717C2 /* Date+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+.swift"; sourceTree = "<group>"; };
A63437292B17A41400A717C2 /* TodoRequestDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoRequestDTO.swift; sourceTree = "<group>"; };
A6AB519B2B328BEF00C94A7F /* TaskDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskDetailViewController.swift; sourceTree = "<group>"; };
A6AB519D2B32D4E500C94A7F /* MoyaProvider+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MoyaProvider+.swift"; sourceTree = "<group>"; };
A6AB519F2B32F4B500C94A7F /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
A6B2AFFA2AFB96A80070A772 /* ToDoListApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ToDoListApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
A6B2AFFD2AFB96A80070A772 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
A6B2AFFF2AFB96A80070A772 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,6 +127,8 @@
A6B2B0112AFBA0860070A772 /* MainTabBarController.swift */,
A6B2B0132AFBA0B90070A772 /* TaskViewController.swift */,
A6B2B0152AFBA0D00070A772 /* SettingViewController.swift */,
A6AB519B2B328BEF00C94A7F /* TaskDetailViewController.swift */,
A6AB519F2B32F4B500C94A7F /* LoginViewController.swift */,
);
path = VCs;
sourceTree = "<group>";
Expand All @@ -139,6 +147,7 @@
children = (
A63437272B17945300A717C2 /* Date+.swift */,
A6B2B0212B02A3B50070A772 /* UILabel+.swift */,
A6AB519D2B32D4E500C94A7F /* MoyaProvider+.swift */,
);
path = Classes;
sourceTree = "<group>";
Expand All @@ -147,7 +156,7 @@
isa = PBXGroup;
children = (
A6E1A2FB2B0F1D170014D9A3 /* TaskManager.swift */,
A63437162B14F31000A717C2 /* Task.swift */,
A63437162B14F31000A717C2 /* Todo.swift */,
A63437212B17276C00A717C2 /* TodoAPI.swift */,
A63437252B1755FA00A717C2 /* TodoResponseDTO.swift */,
A63437292B17A41400A717C2 /* TodoRequestDTO.swift */,
Expand Down Expand Up @@ -242,11 +251,14 @@
A6E1A2FC2B0F1D170014D9A3 /* TaskManager.swift in Sources */,
A6B2AFFE2AFB96A80070A772 /* AppDelegate.swift in Sources */,
A634372A2B17A41400A717C2 /* TodoRequestDTO.swift in Sources */,
A63437172B14F31000A717C2 /* Task.swift in Sources */,
A63437172B14F31000A717C2 /* Todo.swift in Sources */,
A6B2B0142AFBA0B90070A772 /* TaskViewController.swift in Sources */,
A6B2B0122AFBA0860070A772 /* MainTabBarController.swift in Sources */,
A6AB519C2B328BEF00C94A7F /* TaskDetailViewController.swift in Sources */,
A6AB519E2B32D4E500C94A7F /* MoyaProvider+.swift in Sources */,
A6B2B0222B02A3B50070A772 /* UILabel+.swift in Sources */,
A63437222B17276C00A717C2 /* TodoAPI.swift in Sources */,
A6AB51A02B32F4B500C94A7F /* LoginViewController.swift in Sources */,
A63437282B17945300A717C2 /* Date+.swift in Sources */,
A6B2B0002AFB96A80070A772 /* SceneDelegate.swift in Sources */,
A6B2B0162AFBA0D00070A772 /* SettingViewController.swift in Sources */,
Expand Down Expand Up @@ -317,7 +329,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -371,7 +383,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.4;
IPHONEOS_DEPLOYMENT_TARGET = 17.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand All @@ -388,6 +400,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 39R4Y76837;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ToDoListApp/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down Expand Up @@ -415,6 +428,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 39R4Y76837;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ToDoListApp/Info.plist;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,4 @@
uuid = "68523EC1-307B-4CF1-BC37-E1E64052650B"
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "62928FA6-991D-4AF0-BD37-32EC92E43A54"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ToDoListApp/Sources/VCs/TaskViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "288"
endingLineNumber = "288"
landmarkName = "removeTask(forCell:)"
landmarkType = "7">
<Locations>
<Location
uuid = "62928FA6-991D-4AF0-BD37-32EC92E43A54 - 3f1504669a135b31"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "ToDoListApp.TaskViewController.removeTask(forCell: ToDoListApp.TaskTableViewCell) -&gt; ()"
moduleName = "ToDoListApp"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/daehyunlee/Desktop/2023_AppCenter/iOS15.5_Study/DaeHyun/ToDoListApp/ToDoListApp/Sources/VCs/TaskViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "186"
endingLineNumber = "186"
offsetFromSymbolStart = "488">
</Location>
<Location
uuid = "62928FA6-991D-4AF0-BD37-32EC92E43A54 - 3f1504669a135b31"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
symbolName = "ToDoListApp.TaskViewController.removeTask(forCell: ToDoListApp.TaskTableViewCell) -&gt; ()"
moduleName = "ToDoListApp"
usesParentBreakpointCondition = "Yes"
urlString = "file:///Users/daehyunlee/Desktop/2023_AppCenter/iOS15.5_Study/DaeHyun/ToDoListApp/ToDoListApp/Sources/VCs/TaskViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "186"
endingLineNumber = "186"
offsetFromSymbolStart = "188">
</Location>
</Locations>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "5578F295-DD12-4EB2-AA5C-782CB292D84A"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ToDoListApp/Sources/VCs/TaskViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "290"
endingLineNumber = "290"
landmarkName = "removeTask(forCell:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<key>ToDoListApp.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
16 changes: 15 additions & 1 deletion DaeHyun/ToDoListApp/ToDoListApp/Resources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,25 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let viewController = MainTabBarController()
// let viewController = MainTabBarController()
let viewController = LoginViewController()
viewController.view.backgroundColor = .systemBackground
window?.rootViewController = viewController
window?.makeKeyAndVisible()
}

func changeRootVC(_ vc: UIViewController, animated: Bool) {
guard let window = self.window else { return }
window.rootViewController = vc

UIView.transition(
with: window,
duration: 0.2,
options: [.transitionCrossDissolve],
animations: nil,
completion: nil
)
}

func sceneDidDisconnect(_ scene: UIScene) {
// Called as the scene is being released by the system.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ final class TaskTableViewCell: UITableViewCell {
return button
}()

func setupUI(task: Task) {
func setupUI(task: Todo) {
self.taskLabel.text = task.name
self.isTaskComplete = task.isCompleted
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// MoyaProvider+.swift
// ToDoListApp
//
// Created by 이대현 on 12/20/23.
//

import Moya

extension MoyaProvider {
func request(_ target: Target) async -> Result<Response, MoyaError> {
await withCheckedContinuation { continuation in
self.request(target) { result in
continuation.resume(returning: result)
}
}
}
}
10 changes: 5 additions & 5 deletions DaeHyun/ToDoListApp/ToDoListApp/Sources/Models/TaskManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
import Foundation

class TaskManager {
var todayTaskData: [Task] = []
var upcomingTaskData: [Task] = []
var todayTaskData: [Todo] = []
var upcomingTaskData: [Todo] = []

static let shared: TaskManager = TaskManager()

private init(){}


func fetchTaskData(key: String) -> [Task]? {
func fetchTaskData(key: String) -> [Todo]? {
if let taskData = UserDefaults.standard.object(forKey: key) as? Data{
let decoder = JSONDecoder()
if let tasks = try? decoder.decode([Task].self, from: taskData) {
if let tasks = try? decoder.decode([Todo].self, from: taskData) {
return tasks
}
}
return nil
}

func saveTaskData(data: [Task], key: String) {
func saveTaskData(data: [Todo], key: String) {
let encoder = JSONEncoder()
if let encoded = try? encoder.encode(data) {
UserDefaults.standard.setValue(encoded, forKey: key)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
//
// Task.swift
// Todo.swift
// ToDoListApp
//
// Created by 이대현 on 2023/11/14.
//

import Foundation

enum TaskSection: Int {
enum TodoSection: Int {
case Today
case Upcoming
}

struct Task: Hashable, Codable {
struct Todo: Hashable, Codable {
let id: String
let name: String
var isCompleted: Bool
var deadLine: Date
init(id: String, name: String, isCompleted: Bool, deadLine: Date) {
var content: String

init(id: String,
name: String,
isCompleted: Bool,
deadLine: Date,
content: String = ""
) {
self.id = id
self.name = name
self.isCompleted = isCompleted
self.deadLine = deadLine
self.content = content
}
}

19 changes: 15 additions & 4 deletions DaeHyun/ToDoListApp/ToDoListApp/Sources/Models/TodoAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import Foundation
import Moya

let USERID = 1 // 해당 id에 해당하는 유저의 todolist 불러옴

enum TodoAPI {
case getList
// Todo 정보 API
case getDetail(_ id: Int)
case updateTodo(_ id: Int, _ params: TodoRequestDTO)
case createTodo(_ params: TodoRequestDTO)
case updateCheck(_ id: Int, _ completed: Bool)
case deleteTodo(_ id: Int)
// 유저 정보 API
case getList
}

extension TodoAPI: TargetType {
Expand All @@ -30,18 +35,20 @@ extension TodoAPI: TargetType {
return "/todos/\(USERID)"
case .updateCheck(_, _):
return "/todos/check"
case .deleteTodo(let id):
case .deleteTodo(let id),
.getDetail(let id),
.updateTodo(let id, _):
return "/todos/\(id)"
}
}

var method: Moya.Method {
switch self {
case .getList:
case .getList, .getDetail(_):
return .get
case .createTodo(_):
return .post
case .updateCheck(_, _):
case .updateCheck(_, _), .updateTodo(_, _):
return .put
case .deleteTodo(_):
return .delete
Expand All @@ -62,6 +69,10 @@ extension TodoAPI: TargetType {
return .requestParameters(parameters: params, encoding: URLEncoding.queryString)
case .deleteTodo(_):
return .requestPlain
case .getDetail(_):
return .requestPlain
case .updateTodo(_, let params):
return .requestJSONEncodable(params)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ struct TodoResponseDTO: Decodable {
var title: String
var isCompleted: Bool
var deadLine: String
var content: String

func toTask() -> Task {
return Task(id: String(self.id),
func toTodo() -> Todo {
return Todo(id: String(self.id),
name: self.title,
isCompleted: self.isCompleted,
deadLine: self.deadLineDate
deadLine: self.deadLineDate,
content: self.content
)
}

Expand Down
Loading