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

๐Ÿšš [Feat] modifier folder structure & set network #27

Merged
merged 1 commit into from
Jun 20, 2024
Merged
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
35 changes: 35 additions & 0 deletions Projects/App/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// AppDelegate.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation
import UIKit

class AppDelegate: UIResponder, UIApplicationDelegate {

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
return true
}

// MARK: UISceneSession Lifecycle

func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(
_ application: UIApplication,
didDiscardSceneSessions sceneSessions: Set<UISceneSession>
) {}
}
39 changes: 39 additions & 0 deletions Projects/App/Sources/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// SceneDelegate.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
}

func sceneDidDisconnect(_ scene: UIScene) {
// ์‚ฌ์šฉ์ž๊ฐ€ ์•ฑ์„ ์ข…๋ฃŒํ•  ๋•Œ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ
}

func sceneDidBecomeActive(_ scene: UIScene) {
// ์•ฑ์ด ํ™œ์„ฑํ™”๋˜์–ด ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์ƒํƒœ๊ฐ€ ๋˜์—ˆ์„ ๋•Œ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ
}

func sceneWillResignActive(_ scene: UIScene) {
// ์•ฑ์ด ๋น„ํ™œ์„ฑํ™”๋˜์–ด ์ผ์‹œ ์ค‘์ง€๋œ ์ƒํƒœ๊ฐ€ ๋  ๋•Œ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ
}

func sceneWillEnterForeground(_ scene: UIScene) {
// ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ์—์„œ ํฌ๊ทธ๋ผ์šด๋“œ๋กœ ์ „ํ™˜๋˜๊ธฐ ์ง์ „์— ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ
}

func sceneDidEnterBackground(_ scene: UIScene) {
// ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ๋กœ ๋“ค์–ด๊ฐ”์„ ๋•Œ ์‹คํ–‰๋˜๋Š” ์ฝ”๋“œ
}
}
24 changes: 24 additions & 0 deletions Projects/App/Sources/Data/EndPoint/EndPoint.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// EndPoint.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

struct APIEndPoint {
static let baseURL = ""

enum Auth {
case login
case checkNickname
case join
case logout
}

enum Home {
case product
}
}
17 changes: 17 additions & 0 deletions Projects/App/Sources/Data/Error/NetworkError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NetworkError.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

enum NetworkError: Error {
case notConnected
case response
case decode
case apiError
case urlError
}
11 changes: 11 additions & 0 deletions Projects/App/Sources/Data/Mapper/ResultMapper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// ResultMapper.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

// Decoder ๋˜๋Š” ์˜ต์…”๋„ Mapper ์ƒ์„ฑ
20 changes: 20 additions & 0 deletions Projects/App/Sources/Data/Repository/AuthRepository.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// DataRepository.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

class AuthRepository: AuthRepositoryProtocol {

let apiService = ApiService()

func kakaoLogin(_ token: String) async -> Result<String, NetworkError> {
// TODO: - Implement Kakao Login

return .success("success")
}
}
31 changes: 31 additions & 0 deletions Projects/App/Sources/Data/Service/ApiService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// ApiService.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

enum ApiMethod {
case get
case put
case post
case patch
case delete
}

class ApiService {
func request(
apiMethod: ApiMethod,
endPoint: String,
QueryParameter: [String : String]? = nil
) async -> Result<Data, NetworkError> {
return .failure(.notConnected)

// TODO: - Network ์ž‘์—…

}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// AuthReposity.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

// Implement Auth Interface
protocol AuthRepositoryProtocol {
func kakaoLogin(_ token: String) async -> Result<String, NetworkError>
}

17 changes: 17 additions & 0 deletions Projects/App/Sources/Domain/Usecase/Usecase.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Usecase.swift
// App
//
// Created by ๋ฐ•์„œ์—ฐ on 2024/06/20.
// Copyright ยฉ 2024 iOS. All rights reserved.
//

import Foundation

struct AuthUseCase {
let authRepositoryProtocol: AuthRepositoryProtocol

func kakaoLogin(_ token: String) async -> Result<String, NetworkError> {
return await authRepositoryProtocol.kakaoLogin(token)
}
}
15 changes: 0 additions & 15 deletions Projects/App/Sources/Extension/Common.swift

This file was deleted.