Skip to content

jihoonme/tuistui

Repository files navigation

header

GitHub

TuistUI is Style Plugin for cooler use of Tuist.

Installation

In order to tell Tuist you'd like to use TuistUI plugin in your project follow the instructions that are described in Tuist documentation.

Add the plugin to Config.swift.

import ProjectDescription

let config = Config(
    plugins: [
        .git(url: "https://github.com/jihoonme/tuistui", tag: "vTAG")
    ]
)

Documentation

The documentation for releases and main are available here:

Using

Then import the TuistUI from thr location you want to use.

import TuistUI

Creating Project with TuistUI

struct BaseFeature: Module {
    var body: some Module {
        Project {
            /// Target Code
        }
        .organizationName("")
        .package {
            /// Package Code
        }
    }
}

additional operations

let project = BaseFeature().module()

Creating Workspace with TuistUI

struct TuistApp: Module {
    var body: some Module {
        Workspace {
            Path.relativeToRoot("Projects/App")
        }
        .scheme {
            /// Scheme Code
        }
    }
}

additional operations

let workspace = TuistApp().module()

Constant management

ModuleObject can manage redundant parts of a project or workspace.

struct AppEnvironment: ModuleObject {
    static let organizationName: String = ""
    static let destinations: Destinations = .iOS
    static let deploymentTargets: DeploymentTargets = .iOS("15.0")
}

How to use within a module.

struct BaseProject: Module {
    @Constant var env = AppEnvironment()

    var body: Module {
        Project {
            // Target
        }
        .organizationName(env.organizationName)
    }
}

Configuration management

Management configurations effectively using the XCConfig Protocol.

struct AppConfiguration: XCConfig {

    enum XCConfigTarget: String, XCConfigTargetType {
        case baseProject

        var path: Path {
            switch self {
            case .baseProject:
                return .relativeToRoot("XCConfig/baseProject")
            }
        }
    }

    var body: some XCConfigOf<Self> {
        Configure ({
            switch $0 {
            case .baseProject:
                return [
                    // Write Configuration Method
                ]
            }
        })
    }
}

And use .debug(into:name:) method, .release(into:name:) method.

var body: some XCConfigOf<Self> {
    Configure ({
        switch $0 {
        case .A:
            return [
                .debug(into: $0, name: .dev)
                .release(into: $0, name: .prod)
            ]
        }
    })
}

How to use within a module.

struct BaseProject: Module {
    let config = AppConfiguration()

    var body: Module {
        Project {
            // Target
        }
        .settings(
            .settings(
                configurations: config.configure(into: .baseProject)
            )
        )
    }
}

Templates

It is designed to accelerate project creation and workspace creation with templates.

$ tuist scaffold $(templateName) --path $(path) --name $(name)
Template Name
  • project
  • workspace

Project Structure With TuistUI

Project File and Workplace File are gathered in one place to facilitate quick modifications.

Using Project Template

.
├── Projects
│   └── App
│     └── Project.swift //<- Project.swift file Generate
├── Tuist
│   ├── ProjectDescriptionHelpers
│     └── Projects
│       └── DemoProject.swift //<- DemoProject.swift file Generate
│   ├── Dependencies.swift
│   ├── Config.swift
│   └── Package.swift
└── README.md

Using Workspace Template

.
├── Projects
│   └── App
│     └── Workspace.swift //<- Workspace.swift file Generate
├── Tuist
│   ├── ProjectDescriptionHelpers
│     └── Workspace
│       └── DemoApp.swift //<- DemoApp.swift file Generate
│   ├── Dependencies.swift
│   ├── Config.swift
│   └── Package.swift
└── README.md

To modify the contents of a project and workspace, you only need to modify the ProjectDescription File, WorkspaceDescription File, which are clustered in the ProjectDescription Helper folder.

License

tuistui is under MIT license. See the LICENSE file for more info.