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

[TNT-80] Static Library에서도 Preview를 사용 가능하도록 Tuist 수정 #29

Merged
merged 4 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion TnT/Projects/DI/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.module(name: "DI", resources: false)
//let project = Project.module(name: "DI", resources: false)


2 changes: 1 addition & 1 deletion TnT/Projects/Data/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.module(name: "Data", resources: false)
let project = Project.staticLibraryProejct(name: "Data", resource: false)
3 changes: 2 additions & 1 deletion TnT/Projects/DesignSystem/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.module(name: "DesignSystem", resources: true)
let project = Project.staticLibraryProejct(name: "DesignSystem", resource: true)
//dynamicFrameworkProject(name: "DesignSystem", resources: true)
11 changes: 5 additions & 6 deletions TnT/Projects/DesignSystem/Sources/Button/TBottomButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct TBottomButton: View {
/// 버튼의 제목 텍스트
public let title: String
/// 버튼의 상태
public let state: ButtonState
public let isEnable: Bool
/// 버튼이 탭되었을 때 실행할 동작 (옵셔널)
public var action: (() -> Void)

Expand All @@ -24,23 +24,22 @@ public struct TBottomButton: View {
/// - action: 버튼 탭 시 실행할 동작 (옵셔널)
public init(
title: String,
state: ButtonState,
isEnable: Bool,
action: (@escaping () -> Void)
) {
self.title = title
self.state = state
self.isEnable = isEnable
self.action = action
}

public var body: some View {
Button(title) {
action()
}
.typographyStyle(.heading4, with: state.textColor)
.typographyStyle(.heading4, with: isEnable ? ButtonState.true.textColor : ButtonState.false.textColor)
.padding(.vertical, 20)
.frame(maxWidth: .infinity)
.background(state.background)
.ignoresSafeArea()
.background(isEnable ? ButtonState.true.textColor : ButtonState.false.textColor)
}
}

Expand Down
10 changes: 10 additions & 0 deletions TnT/Projects/DesignSystem/Sources/Navigation/TNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,13 @@ public enum TNavigationCase {
/// 왼쪽 이미지
case LButton(leftImage: ImageResource)
}

struct TNavigationView: View {
var body: some View {
TNavigation(type: .LButton(leftImage: .icnArrowDown))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 Struct는 어떤 용도로 사용하는 걸까요??

Copy link
Member Author

Choose a reason for hiding this comment

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

이거 프리뷰 테스트 용으로 만들었던 것 같습니다... (?) 발견 감사해요 수정해놓을게요!


#Preview(body: {
TNavigationView()
})
2 changes: 1 addition & 1 deletion TnT/Projects/Domain/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.module(name: "Domain", resources: false)
let project = Project.staticLibraryProejct(name: "Domain", resource: false)

12 changes: 11 additions & 1 deletion TnT/Projects/Domain/Sources/DomainSoureDummy.swift
Copy link
Contributor

Choose a reason for hiding this comment

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

안 쓰이는 내용은 정리해주시면 좋을 것 같아요!

Copy link
Member Author

Choose a reason for hiding this comment

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

넵!

Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,14 @@
// Created by 박서연 on 1/4/25.
//

import Foundation
import SwiftUI

struct TEestView: View {
var body: some View {
Text("dd")
}
}

#Preview {
TEestView()
}
2 changes: 1 addition & 1 deletion TnT/Projects/Presentation/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.module(name: "Presentation", resources: false)
let project = Project.staticLibraryProejct(name: "Presentation", resource: false)

13 changes: 12 additions & 1 deletion TnT/Projects/Presentation/Sources/PresentationSoureDummy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,15 @@
// Created by 박서연 on 1/4/25.
//

import Foundation
import SwiftUI

struct TTestView: View {
var body: some View {
// TNavigation(type: .LButton(leftImage: .icArrowDown))
Text("DD")
}
}

#Preview {
TTestView()
}
2 changes: 1 addition & 1 deletion TnT/Projects/TnTApp/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
@preconcurrency import ProjectDescription
@preconcurrency import ProjectDescriptionHelpers

let project = Project.app
let project = Project.appProject()
3 changes: 2 additions & 1 deletion TnT/Projects/TnTApp/Sources/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import SwiftUI

struct ContentView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
Text("dasdasdf")
Text("Hello, World!")
}
}

Expand Down
14 changes: 14 additions & 0 deletions TnT/Tuist.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Tuist.swift
// Manifests
//
// Created by 박서연 on 1/22/25.
//

import ProjectDescription

let tuist = Tuist.init(
project: .tuist(
compatibleXcodeVersions: ["16.2"]
)
)
Comment on lines +10 to +14
Copy link
Contributor

Choose a reason for hiding this comment

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

이런 세팅이 있는 줄은 처음 알았네요..! 협업 시 너무 좋은 것 같습니다 👍👍

11 changes: 2 additions & 9 deletions TnT/Tuist/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,8 @@

let packageSettings = PackageSettings(
// Customize the product types for specific package product
// Default is .staticFramework
// productTypes: ["Alamofire": .framework,]
productTypes: [:],
baseSettings: .settings(
configurations: [
.debug(name: .debug),
.release(name: .release)
]
)
// Default is .staticFramework
productTypes: [:]
)
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
@preconcurrency import ProjectDescription

public extension Configuration {
// static func defaultSettings() -> Settings {
// return Settings.settings(
// configurations: [
// .debug(name: .debug, xcconfig: .relativeToRoot("Tuist/Config/Secrets.xcconfig")),
// .release(name: .release, xcconfig: .relativeToRoot("Tuist/Config/Secrets.xcconfig")),
// ],
// defaultSettings: DefaultSettings.recommended
// )
// }

static func defaultSettings() -> Settings {
return Settings.settings(
base: ["OTHER_LDFLAGS": ["-ObjC"]],
configurations: [
.debug(name: .debug, xcconfig: .relativeToRoot("Tuist/Config/Secrets.xcconfig")),
.release(name: .release, xcconfig: .relativeToRoot("Tuist/Config/Secrets.xcconfig")),
],
defaultSettings: DefaultSettings.recommended
)
return Settings.settings()
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,38 @@
@preconcurrency import ProjectDescription

let dependencyInfo: [DependencyInformation: [DependencyInformation]] = [
.TnTApp: [.Presentation],
.TnTApp: [.Presentation, .DesignSystem],
.Presentation: [.DesignSystem, .Domain, .ComposableArchitecture],
.Domain: [.Data, .SwiftDepedencies, .KakaoSDKUser],
.Data: [],
.DesignSystem: [.ComposableArchitecture, .Lottie],
Copy link
Contributor

@FpRaArNkK FpRaArNkK Jan 23, 2025

Choose a reason for hiding this comment

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

요부분 관련해서 전에 얘기했었던 내용들도 추가로 반영해주실 수 있을까요?!

  • Domain -> Data를 지우고, Data -> Domain로 변경
  • App -> Data 추가
  • Data -> KakaoSDK 로 변경
  • DesignSystem -> TCA 삭제
    모듈 구조 v2 내용 정리 문서 정리해놓았습니다!
    추가로 App에 디자인 시스템 들어가게된 이유도 궁금해요!

Copy link
Member Author

Choose a reason for hiding this comment

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

이것도.. 이것저것 테스트하다가 추가된 것같은데 말씀해주신 사항 수정해놓을게요.

.DI: []
]

public enum DependencyInformation: String, CaseIterable, Sendable {
case TnTApp = "TnTApp"
case Presentation = "Presentation"
case Domain = "Domain"
case Data = "Data"
case DI = "DI"
case DesignSystem = "DesignSystem"
case Lottie = "Lottie"
case ComposableArchitecture = "ComposableArchitecture"
case KakaoSDKUser = "KakaoSDKUser"
case SwiftDepedencies = "Dependencies"
}

extension DependencyInformation {
public func setDependency(module: DependencyInformation) -> TargetDependency {
switch self {
case .TnTApp:
return .project(target: self.rawValue, path: "Projects/TnTApp")
case .Presentation:
return .project(target: self.rawValue, path: "Projects/Presentation")
case .Domain:
return .project(target: self.rawValue, path: "Projects/Domain")
case .Data:
return .project(target: self.rawValue, path: "Projects/Data")
case .DI:
return .project(target: self.rawValue, path: "Projects/DI")
case .DesignSystem:
return .project(target: self.rawValue, path: "Projects/DesignSystem")
default:
return .project(target: "none", path: "")
public extension DependencyInformation {
static func dependencies(of name: String) -> [TargetDependency] {
guard let name = DependencyInformation(rawValue: name) else { return [] }
guard let modules: [DependencyInformation] = dependencyInfo[name] else { return [] }

return modules.map { module in
let name = module.rawValue

if externalDependency.contains(module) {
return .external(name: name)
} else {
return .project(target: name, path: .relativeToRoot("Projects/\(name)"))
}
Comment on lines +31 to +42
Copy link
Contributor

Choose a reason for hiding this comment

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

더 깔끔해지고 모듈 확장성이 좋아졌네요! 👍👍

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

@preconcurrency import ProjectDescription

public let environmentName: String = "TnTApp"
public let environmentOrganizationName: String = "yapp25thTeamTnT"
public let environmentDeploymentTargets: DeploymentTargets = .iOS("17.0")
public let environmentPlatform: Platform = .iOS
public let environmentDestinations: Destinations = [.iPhone]
public enum Environment {
public static let appName: String = "TnTApp"
public static let organizationName = "yapp25thTeamTnT"
public static let destinations: Destinations = .iOS
public static let deploymentTarget: DeploymentTargets = .iOS("17.0")
}
Loading