Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 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
10 changes: 6 additions & 4 deletions Plugins/EnvPlugin/ProjectDescriptionHelpers/InfoPlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ public extension Project {
"NSAppTransportSecurity": .dictionary([
"NSAllowsArbitraryLoads": .boolean(true)
]),
"ITSAppUsesNonExemptEncryption": .boolean(false)
"ITSAppUsesNonExemptEncryption": .boolean(false),
"BASE_URL": .string("$(BASE_URL)")
]

static let demoInfoPlist: [String: Plist.Value] = [
"CFBundleShortVersionString": .string("1.0.0"),
"CFBundleDevelopmentRegion": .string("ko"),
Expand All @@ -57,9 +58,10 @@ public extension Project {
"NSAppTransportSecurity": .dictionary([
"NSAllowsArbitraryLoads": .boolean(true)
]),
"ITSAppUsesNonExemptEncryption": .boolean(false)
"ITSAppUsesNonExemptEncryption": .boolean(false),
"BASE_URL": .string("$(BASE_URL)")
]

static let framework: InfoPlist = .extendingDefault(with: [
"CFBundlePackageType": "FMWK"
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public extension Settings {
static let frameworkSettings: Settings = .settings(
base: [
"SKIP_INSTALL": "YES",
"BUILD_LIBRARY_FOR_DISTRIBUTION": "YES",
"BUILD_LIBRARY_FOR_DISTRIBUTION": "NO",
"DEFINES_MODULE": "YES",
"ENABLE_BITCODE": "NO",
"IPHONEOS_DEPLOYMENT_TARGET": .string(Environment.deploymentTarget),
Expand Down
1 change: 1 addition & 0 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let project = Project.makeModule(
scripts: [.swiftLint],
dependencies: [
.data,
.Modules.networks,
.Features.rootFeature
],
settings: .appSettings()
Expand Down
19 changes: 19 additions & 0 deletions Projects/Data/Sources/DI/AuthRepositoryFactory.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AuthRepositoryFactory.swift
// Data
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Domain
import Foundation
import Networks

public func makeAuthService() -> AuthServiceProtocol {
AuthService()
}

public func makeAuthRepository(authService: AuthServiceProtocol) -> AuthRepositoryProtocol {
AuthRepository(authService: authService)
}
40 changes: 40 additions & 0 deletions Projects/Data/Sources/Repository/Auth/AuthRepository.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// AuthRepository.swift
// Data
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Domain
import Foundation
import Networks

public final class AuthRepository: AuthRepositoryProtocol, @unchecked Sendable {
private let authService: AuthServiceProtocol

public init(authService: AuthServiceProtocol) {
self.authService = authService
}

public func signup(info: SignupInfo) async -> Result<SignupResult, SignupError> {
let request = SignupRequest(fcmToken: info.fcmToken)
let result = await authService.signup(request: request)

switch result {
case .success(let response):
let signupResult = SignupResult(
uuid: response.uuid,
accessToken: response.accessToken,
nickname: response.nickname
)
return .success(signupResult)

case .failure(let error):
return .failure(error)

case .networkFailure(let networkError):
return .failure(.networkError(message: networkError.localizedDescription))
}
}
}
27 changes: 27 additions & 0 deletions Projects/Data/Sources/Transform/Auth/AuthTransform.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// AuthTransform.swift
// Data
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Domain
import Foundation
import Networks

extension SignupResult {
init(from response: SignupResponse) {
self.init(
uuid: response.uuid,
accessToken: response.accessToken,
nickname: response.nickname
)
}
}

extension SignupRequest {
init(from info: SignupInfo) {
self.init(fcmToken: info.fcmToken)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AuthRepositoryProtocol.swift
// Domain
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

public protocol AuthRepositoryProtocol: Sendable {
func signup(info: SignupInfo) async -> Result<SignupResult, SignupError>
}
26 changes: 26 additions & 0 deletions Projects/Domain/Sources/Model/Auth/SignupError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// SignupError.swift
// Domain
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

// MARK: - SignupField

public enum SignupField: Sendable, Equatable {
case fcmToken
case email
case unknown(String)
}

// MARK: - SignupError

public enum SignupError: Error, Sendable {
case validationFailed(field: SignupField, message: String)
case serverError(message: String?)
case networkError(message: String)
case unknown(code: String, message: String)
}
17 changes: 17 additions & 0 deletions Projects/Domain/Sources/Model/Auth/SignupInfo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// SignupInfo.swift
// Domain
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

public struct SignupInfo: Sendable {
public let fcmToken: String

public init(fcmToken: String) {
self.fcmToken = fcmToken
}
}
21 changes: 21 additions & 0 deletions Projects/Domain/Sources/Model/Auth/SignupResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// SignupResult.swift
// Domain
//
// Created by kimnahun on 1/21/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

public struct SignupResult: Sendable {
public let uuid: String
public let accessToken: String
public let nickname: String

public init(uuid: String, accessToken: String, nickname: String) {
self.uuid = uuid
self.accessToken = accessToken
self.nickname = nickname
}
}
22 changes: 21 additions & 1 deletion Projects/Modules/Networks/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,38 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin
import EnvPlugin

let project = Project.makeModule(
name: "Networks",
targets: [
.makeFrameworkTarget(
name: "Networks",
dependencies: [
.core
.core,
.domain
],
scripts: [.swiftLint],
isStatic: true,
hasResources: false
),
.target(
name: "NetworksTests",
destinations: .iOS,
product: .unitTests,
bundleId: "org.yapp.NDGL.NetworksTests",
deploymentTargets: .iOS("17.0"),
infoPlist: .extendingDefault(with: [
"BASE_URL": .string("$(BASE_URL)")
]),
sources: ["Tests/**"],
dependencies: [
.target(name: "Networks")
],
settings: .settings(configurations: [
.debug(name: "Debug", xcconfig: .relativeToRoot("xcconfigs/Debug.xcconfig")),
.release(name: "Release", xcconfig: .relativeToRoot("xcconfigs/Release.xcconfig"))
])
Comment on lines +32 to +42
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for BASE_URL definition in xcconfig files
echo "=== Searching for BASE_URL in xcconfig files ==="
rg -n "BASE_URL" xcconfigs -g "*.xcconfig"

echo -e "\n=== Listing all xcconfig files ==="
fd -t f -e xcconfig xcconfigs

echo -e "\n=== Content of xcconfig files ==="
fd -t f -e xcconfig xcconfigs -x cat -n {}

Repository: YAPP-Github/27th-App-Team-1-iOS

Length of output: 194


🏁 Script executed:

#!/bin/bash
# Check if xcconfigs directory exists
echo "=== Checking xcconfigs directory ==="
ls -la xcconfigs 2>&1 || echo "Directory does not exist"

echo -e "\n=== Searching for any xcconfig files in entire repo ==="
find . -name "*.xcconfig" -type f 2>/dev/null

echo -e "\n=== Checking project structure around Projects/Modules/Networks ==="
ls -la Projects/Modules/Networks/ 2>&1 | head -30

echo -e "\n=== Searching for BASE_URL references in entire project ==="
rg -n "BASE_URL" . -g "!.git" | head -20

Repository: YAPP-Github/27th-App-Team-1-iOS

Length of output: 1364


xcconfig 파일 누락으로 인한 빌드 실패 위험 - 즉시 수정 필요

39-42줄에서 참조하는 xcconfigs/Debug.xcconfigxcconfigs/Release.xcconfig 파일이 존재하지 않습니다. 33줄의 $(BASE_URL) 빌드 변수는 해석되지 않아 테스트 빌드가 실패하거나, NetworkConfiguration.swift의 fatalError(18줄)로 인해 런타임에 충돌합니다. 누락된 xcconfig 파일들을 추가하고 BASE_URL을 정의해야 합니다.

🤖 Prompt for AI Agents
In `@Projects/Modules/Networks/Project.swift` around lines 32 - 42, Add the
missing xcconfig files referenced by settings: create "xcconfigs/Debug.xcconfig"
and "xcconfigs/Release.xcconfig" and define the BASE_URL build setting inside
them (e.g. BASE_URL = https://api.example.com) so the infoPlist
.extendingDefault with "BASE_URL": .string("$(BASE_URL)") resolves; also ensure
NetworkConfiguration.swift’s fatalError path no longer triggers by providing a
valid BASE_URL in the xcconfigs or adding a fallback in NetworkConfiguration
(e.g., guard for BASE_URL before using fatalError) to prevent runtime crashes
during tests.

)
]
)
8 changes: 0 additions & 8 deletions Projects/Modules/Networks/Sources/API/APIEmpty.swift

This file was deleted.

15 changes: 15 additions & 0 deletions Projects/Modules/Networks/Sources/Base/BaseResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// BaseResponse.swift
// Networks
//
// Created by kimnahun on 1/19/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

struct BaseResponse<T: Decodable & Sendable>: Decodable, Sendable {
let code: String
let message: String
let data: T?
}
11 changes: 11 additions & 0 deletions Projects/Modules/Networks/Sources/Base/EmptyResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// EmptyResponse.swift
// Networks
//
// Created by kimnahun on 1/19/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

struct EmptyResponse: Decodable, Sendable {}
20 changes: 20 additions & 0 deletions Projects/Modules/Networks/Sources/Base/ErrorResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// ErrorResponse.swift
// Networks
//
// Created by kimnahun on 1/19/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

public struct ErrorResponse: Decodable, Sendable {
public let code: String?
public let message: String?
public let errors: [ErrorDetail]?

public struct ErrorDetail: Decodable, Sendable {
public let field: String?
public let message: String?
}
}
8 changes: 0 additions & 8 deletions Projects/Modules/Networks/Sources/Base/NBaseEmpty.swift

This file was deleted.

26 changes: 26 additions & 0 deletions Projects/Modules/Networks/Sources/Base/NetworkError.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// NetworkError.swift
// Networks
//
// Created by kimnahun on 1/19/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

public enum NetworkError: Error, Sendable {
case connectionFailed
case decodingFailed
case unknown(String)

public var message: String {
switch self {
case .connectionFailed:
return "네트워크 연결을 확인해주세요"
case .decodingFailed:
return "데이터 처리 중 오류가 발생했습니다"
case .unknown(let description):
return "알 수 없는 오류: \(description)"
}
}
}
16 changes: 16 additions & 0 deletions Projects/Modules/Networks/Sources/Base/NetworkResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// NetworkResult.swift
// Networks
//
// Created by kimnahun on 1/19/26.
// Copyright © 2026 NDGL-iOS. All rights reserved.
//

import Foundation

@frozen
public enum NetworkResult<T: Sendable, E: Error & Sendable>: Sendable {
case success(T)
case failure(E)
case networkFailure(NetworkError)
}
Loading