From 1d1925db0516131974894aaa9b3f1189b24e3b26 Mon Sep 17 00:00:00 2001 From: choidam <37874238+choidam@users.noreply.github.com> Date: Tue, 12 Apr 2022 11:52:23 +0900 Subject: [PATCH 1/4] tuist init --- KIDA/Tuist/.gitignore | 70 +++++++++++++++++ KIDA/Tuist/Project.swift | 35 +++++++++ .../Tuist/Resources/LaunchScreen.storyboard | 25 ++++++ .../Targets/Tuist/Sources/AppDelegate.swift | 25 ++++++ KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift | 8 ++ .../Targets/TuistKit/Sources/TuistKit.swift | 7 ++ .../TuistKit/Tests/TuistKitTests.swift | 8 ++ .../Targets/TuistUI/Sources/TuistUI.swift | 7 ++ .../Targets/TuistUI/Tests/TuistUITests.swift | 8 ++ KIDA/Tuist/Tuist/Config.swift | 5 ++ .../Project+Templates.swift | 76 +++++++++++++++++++ 11 files changed, 274 insertions(+) create mode 100644 KIDA/Tuist/.gitignore create mode 100644 KIDA/Tuist/Project.swift create mode 100644 KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard create mode 100644 KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift create mode 100644 KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift create mode 100644 KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift create mode 100644 KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift create mode 100644 KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift create mode 100644 KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift create mode 100644 KIDA/Tuist/Tuist/Config.swift create mode 100644 KIDA/Tuist/Tuist/ProjectDescriptionHelpers/Project+Templates.swift diff --git a/KIDA/Tuist/.gitignore b/KIDA/Tuist/.gitignore new file mode 100644 index 0000000..551a3f5 --- /dev/null +++ b/KIDA/Tuist/.gitignore @@ -0,0 +1,70 @@ +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Projects ### +*.xcodeproj +*.xcworkspace + +### Tuist derived files ### +graph.dot +Derived/ + +### Tuist managed dependencies ### +Tuist/Dependencies diff --git a/KIDA/Tuist/Project.swift b/KIDA/Tuist/Project.swift new file mode 100644 index 0000000..c8399d4 --- /dev/null +++ b/KIDA/Tuist/Project.swift @@ -0,0 +1,35 @@ +import ProjectDescription +import ProjectDescriptionHelpers + +/* + +-------------+ + | | + | App | Contains Tuist App target and Tuist unit-test target + | | + +------+-------------+-------+ + | depends on | + | | + +----v-----+ +-----v-----+ + | | | | + | Kit | | UI | Two independent frameworks to share code and start modularising your app + | | | | + +----------+ +-----------+ + + */ + +// MARK: - Project + +// Creates our project using a helper function defined in ProjectDescriptionHelpers + +let project = Project(name: "KIDA", + targets: [ + Target( + name: "App", + platform: .iOS, + product: .app, + bundleId: "com.ian.KIDA", + infoPlist: .file(path: "../KIDA/Info.plist"), + sources: ["../KIDA/**"] + ) + ] +) diff --git a/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard b/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift b/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift new file mode 100644 index 0000000..cc3662d --- /dev/null +++ b/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift @@ -0,0 +1,25 @@ +import UIKit +import TuistKit +import TuistUI + +@main +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + let viewController = UIViewController() + viewController.view.backgroundColor = .white + window?.rootViewController = viewController + window?.makeKeyAndVisible() + TuistKit.hello() + TuistUI.hello() + + return true + } + +} diff --git a/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift b/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift new file mode 100644 index 0000000..86868c0 --- /dev/null +++ b/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift @@ -0,0 +1,8 @@ +import Foundation +import XCTest + +final class TuistTests: XCTestCase { + func test_twoPlusTwo_isFour() { + XCTAssertEqual(2+2, 4) + } +} \ No newline at end of file diff --git a/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift b/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift new file mode 100644 index 0000000..43149d5 --- /dev/null +++ b/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift @@ -0,0 +1,7 @@ +import Foundation + +public final class TuistKit { + public static func hello() { + print("Hello, from your Kit framework") + } +} diff --git a/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift b/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift new file mode 100644 index 0000000..267926a --- /dev/null +++ b/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift @@ -0,0 +1,8 @@ +import Foundation +import XCTest + +final class TuistKitTests: XCTestCase { + func test_example() { + XCTAssertEqual("TuistKit", "TuistKit") + } +} \ No newline at end of file diff --git a/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift b/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift new file mode 100644 index 0000000..ddcc2ec --- /dev/null +++ b/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift @@ -0,0 +1,7 @@ +import Foundation + +public final class TuistUI { + public static func hello() { + print("Hello, from your UI framework") + } +} diff --git a/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift b/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift new file mode 100644 index 0000000..400b793 --- /dev/null +++ b/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift @@ -0,0 +1,8 @@ +import Foundation +import XCTest + +final class TuistUITests: XCTestCase { + func test_example() { + XCTAssertEqual("TuistUI", "TuistUI") + } +} \ No newline at end of file diff --git a/KIDA/Tuist/Tuist/Config.swift b/KIDA/Tuist/Tuist/Config.swift new file mode 100644 index 0000000..349adcc --- /dev/null +++ b/KIDA/Tuist/Tuist/Config.swift @@ -0,0 +1,5 @@ +import ProjectDescription + +let config = Config( + generationOptions: [] +) diff --git a/KIDA/Tuist/Tuist/ProjectDescriptionHelpers/Project+Templates.swift b/KIDA/Tuist/Tuist/ProjectDescriptionHelpers/Project+Templates.swift new file mode 100644 index 0000000..97deead --- /dev/null +++ b/KIDA/Tuist/Tuist/ProjectDescriptionHelpers/Project+Templates.swift @@ -0,0 +1,76 @@ +import ProjectDescription + +/// Project helpers are functions that simplify the way you define your project. +/// Share code to create targets, settings, dependencies, +/// Create your own conventions, e.g: a func that makes sure all shared targets are "static frameworks" +/// See https://docs.tuist.io/guides/helpers/ + +extension Project { + /// Helper function to create the Project for this ExampleApp + public static func app(name: String, platform: Platform, additionalTargets: [String]) -> Project { + var targets = makeAppTargets(name: name, + platform: platform, + dependencies: additionalTargets.map { TargetDependency.target(name: $0) }) + targets += additionalTargets.flatMap({ makeFrameworkTargets(name: $0, platform: platform) }) + return Project(name: name, + organizationName: "tuist.io", + targets: targets) + } + + // MARK: - Private + + /// Helper function to create a framework target and an associated unit test target + private static func makeFrameworkTargets(name: String, platform: Platform) -> [Target] { + let sources = Target(name: name, + platform: platform, + product: .framework, + bundleId: "io.tuist.\(name)", + infoPlist: .default, + sources: ["Targets/\(name)/Sources/**"], + resources: [], + dependencies: []) + let tests = Target(name: "\(name)Tests", + platform: platform, + product: .unitTests, + bundleId: "io.tuist.\(name)Tests", + infoPlist: .default, + sources: ["Targets/\(name)/Tests/**"], + resources: [], + dependencies: [.target(name: name)]) + return [sources, tests] + } + + /// Helper function to create the application target and the unit test target. + private static func makeAppTargets(name: String, platform: Platform, dependencies: [TargetDependency]) -> [Target] { + let platform: Platform = platform + let infoPlist: [String: InfoPlist.Value] = [ + "CFBundleShortVersionString": "1.0", + "CFBundleVersion": "1", + "UIMainStoryboardFile": "", + "UILaunchStoryboardName": "LaunchScreen" + ] + + let mainTarget = Target( + name: name, + platform: platform, + product: .app, + bundleId: "io.tuist.\(name)", + infoPlist: .extendingDefault(with: infoPlist), + sources: ["Targets/\(name)/Sources/**"], + resources: ["Targets/\(name)/Resources/**"], + dependencies: dependencies + ) + + let testTarget = Target( + name: "\(name)Tests", + platform: platform, + product: .unitTests, + bundleId: "io.tuist.\(name)Tests", + infoPlist: .default, + sources: ["Targets/\(name)/Tests/**"], + dependencies: [ + .target(name: "\(name)") + ]) + return [mainTarget, testTarget] + } +} From 87bc6e5006c441507d0829e7de27289c834fa128 Mon Sep 17 00:00:00 2001 From: choidam <37874238+choidam@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:37:02 +0900 Subject: [PATCH 2/4] =?UTF-8?q?spm=20dependencies=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KIDA/Tuist/Project.swift | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/KIDA/Tuist/Project.swift b/KIDA/Tuist/Project.swift index c8399d4..2731939 100644 --- a/KIDA/Tuist/Project.swift +++ b/KIDA/Tuist/Project.swift @@ -21,6 +21,17 @@ import ProjectDescriptionHelpers // Creates our project using a helper function defined in ProjectDescriptionHelpers +//let carthageDependencies: [CarthageDependencies.Dependency] = [ +// .github(path: "https://github.com/ReactorKit/ReactorKit", requirement: .exact("2.1.1")), +// .github(path: "https://github.com/RxSwiftCommunity/RxDataSources", requirement: .exact("4.0.1")), +// .github(path: "https://github.com/ReactiveX/RxSwift", requirement: .exact("5.1.3")), +// .github(path: "https://github.com/SnapKit", requirement: .exact("5.0.1")), +// .github(path: "https://github.com/devxoul/Then", requirement: .exact("2.7.0")) +//] +// +//let dependencies = Dependencies(carthage: .init(carthageDependencies), platforms: [.iOS]) + + let project = Project(name: "KIDA", targets: [ Target( @@ -29,7 +40,20 @@ let project = Project(name: "KIDA", product: .app, bundleId: "com.ian.KIDA", infoPlist: .file(path: "../KIDA/Info.plist"), - sources: ["../KIDA/**"] + sources: ["../KIDA/**"], + dependencies: [ + .package(product: "ReactorKit"), + .package(product: "RxDataSources"), + .package(product: "RxSwift"), + .package(product: "SnapKit"), + .package(product: "Then") + ] ) ] ) + +public extension TargetDependency { + static func carthage(name: String) -> TargetDependency { + .framework(path: Path("Tuist/Dependencies/Carthage/iOS/\(name).framework")) + } +} From b7f69f46c0762a21d5498e2aad84d0bcec523402 Mon Sep 17 00:00:00 2001 From: choidam <37874238+choidam@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:41:17 +0900 Subject: [PATCH 3/4] =?UTF-8?q?tuist=20bundle=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tuist/Resources/LaunchScreen.storyboard | 25 ------------------- .../Targets/Tuist/Sources/AppDelegate.swift | 25 ------------------- KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift | 8 ------ .../Targets/TuistKit/Sources/TuistKit.swift | 7 ------ .../TuistKit/Tests/TuistKitTests.swift | 8 ------ .../Targets/TuistUI/Sources/TuistUI.swift | 7 ------ .../Targets/TuistUI/Tests/TuistUITests.swift | 8 ------ 7 files changed, 88 deletions(-) delete mode 100644 KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard delete mode 100644 KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift delete mode 100644 KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift delete mode 100644 KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift delete mode 100644 KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift delete mode 100644 KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift delete mode 100644 KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift diff --git a/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard b/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard deleted file mode 100644 index 865e932..0000000 --- a/KIDA/Tuist/Targets/Tuist/Resources/LaunchScreen.storyboard +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift b/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift deleted file mode 100644 index cc3662d..0000000 --- a/KIDA/Tuist/Targets/Tuist/Sources/AppDelegate.swift +++ /dev/null @@ -1,25 +0,0 @@ -import UIKit -import TuistKit -import TuistUI - -@main -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - func application( - _ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil - ) -> Bool { - window = UIWindow(frame: UIScreen.main.bounds) - let viewController = UIViewController() - viewController.view.backgroundColor = .white - window?.rootViewController = viewController - window?.makeKeyAndVisible() - TuistKit.hello() - TuistUI.hello() - - return true - } - -} diff --git a/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift b/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift deleted file mode 100644 index 86868c0..0000000 --- a/KIDA/Tuist/Targets/Tuist/Tests/AppTests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class TuistTests: XCTestCase { - func test_twoPlusTwo_isFour() { - XCTAssertEqual(2+2, 4) - } -} \ No newline at end of file diff --git a/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift b/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift deleted file mode 100644 index 43149d5..0000000 --- a/KIDA/Tuist/Targets/TuistKit/Sources/TuistKit.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -public final class TuistKit { - public static func hello() { - print("Hello, from your Kit framework") - } -} diff --git a/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift b/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift deleted file mode 100644 index 267926a..0000000 --- a/KIDA/Tuist/Targets/TuistKit/Tests/TuistKitTests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class TuistKitTests: XCTestCase { - func test_example() { - XCTAssertEqual("TuistKit", "TuistKit") - } -} \ No newline at end of file diff --git a/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift b/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift deleted file mode 100644 index ddcc2ec..0000000 --- a/KIDA/Tuist/Targets/TuistUI/Sources/TuistUI.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -public final class TuistUI { - public static func hello() { - print("Hello, from your UI framework") - } -} diff --git a/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift b/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift deleted file mode 100644 index 400b793..0000000 --- a/KIDA/Tuist/Targets/TuistUI/Tests/TuistUITests.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation -import XCTest - -final class TuistUITests: XCTestCase { - func test_example() { - XCTAssertEqual("TuistUI", "TuistUI") - } -} \ No newline at end of file From 7b13806651512c19bb7812821d395e8f3e973e15 Mon Sep 17 00:00:00 2001 From: choidam <37874238+choidam@users.noreply.github.com> Date: Tue, 12 Apr 2022 14:49:03 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=EC=A3=BC=EC=84=9D=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KIDA/Tuist/Project.swift | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/KIDA/Tuist/Project.swift b/KIDA/Tuist/Project.swift index 2731939..16fec6f 100644 --- a/KIDA/Tuist/Project.swift +++ b/KIDA/Tuist/Project.swift @@ -19,19 +19,6 @@ import ProjectDescriptionHelpers // MARK: - Project -// Creates our project using a helper function defined in ProjectDescriptionHelpers - -//let carthageDependencies: [CarthageDependencies.Dependency] = [ -// .github(path: "https://github.com/ReactorKit/ReactorKit", requirement: .exact("2.1.1")), -// .github(path: "https://github.com/RxSwiftCommunity/RxDataSources", requirement: .exact("4.0.1")), -// .github(path: "https://github.com/ReactiveX/RxSwift", requirement: .exact("5.1.3")), -// .github(path: "https://github.com/SnapKit", requirement: .exact("5.0.1")), -// .github(path: "https://github.com/devxoul/Then", requirement: .exact("2.7.0")) -//] -// -//let dependencies = Dependencies(carthage: .init(carthageDependencies), platforms: [.iOS]) - - let project = Project(name: "KIDA", targets: [ Target(