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..16fec6f --- /dev/null +++ b/KIDA/Tuist/Project.swift @@ -0,0 +1,46 @@ +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 + +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/**"], + 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")) + } +} 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] + } +}