๐ฐ๐ท ํ๊ตญ์ด๋ก ์ฝ๊ธฐ | ๐บ๐ธ Read in English
Welcome to TuistAutoGen. TuistAutoGen empowers you to fully control the Tuist project lifecycle with just one script execution.
TuistAutoGen is more than just another project creation tool. It's an enabler, a streamliner, a powerhouse that evolves alongside your project's needs. TuistAutoGen is an elegantly designed solution for swift project modularization and framework production, all just one shell execution away!
Traditionally, creating a project using Tuist from scratch to finish poses several challenges:
๐ Complexity
Tuist, while powerful, is quite complex to set up and manage, especially for beginners. It involves various configuration files and requires understanding the Tuist DSL (Domain Specific Language) to create, manipulate, and manage projects.
โฐ Time-Consuming
The process of setting up the project, managing dependencies, creating targets, and generating the Xcode project can be time-consuming, particularly for larger projects with multiple modules and dependencies.
๐ง Prone to Human Error
The manual process of configuration and setup can lead to human errors, resulting in broken builds or runtime issues.
๐ Difficulty in Modularization
While Tuist supports modularization, setting up a modular project can be challenging and involves numerous steps. This includes creating separate modules, managing interdependencies, and ensuring each module can be built independently.
๐ฆฟ Framework Generation
Generating frameworks for a project involves a significant amount of manual work, including setting up the targets, linking dependencies, and managing build settings.
These inherent difficulties often result in slowed down development speed, increased bug risks, and a steeper learning curve for developers new to the system.
On the other hand, TuistAutoGen drastically simplifies these steps by automating project creation, modularization, and framework generation, thus eliminating the aforementioned hurdles. It makes using Tuist a breeze and significantly accelerates the project setup process, reduces the potential for human error, and makes managing complex, modularized projects simple and straightforward. This highlights the advantages of TuistAutoGen and makes it an essential tool for every iOS developer.
TuistAutoGen is written based on Tuist version 3.11.0. Please stick to this version for TuistAutoGen to work properly.
However, if you don't have any installed on your Mac, you may need Homebrew or utility software such as mise, curl, etc.
I've created and distributed another shell script file called TuistInstaller to solve this problem a little more elegantly. TuistInstaller here
TuistInstaller provides the necessary elements for installing Tuist.
Note: TuistAutoGen is based on bash 5.2.15 RC version (aarch64-apple-darwin22.1.0) Too low of a Bash version can interfere with the functioning of the shell script.
To make a single Application, just type command below on your bash shell.
./autoGenerator.sh --main $projectName
For example,
./autoGenerator.sh --main CoreProject
The project name you set will be the main project's name!
Next, we generate the project's name.
๐ Start to generate Tuist Projects!
โ๏ธ What is the name of new Project?
โ๏ธ Your Name of Project is :
<Setting Project Name>
The chosen name will become the name of the entire project!
๐ฆTuistAutoGenerator
โ ๐ autoGenerator.sh
โฃ ๐ temp
โ ๐ Project
ย ย โ ๐ Main Application
Now, the Main project that you set is generated on the under the Project Go to TuistProject to generate your project.
cd TuistProject
and run the Tuist generate
tuist generate
..and you are done! The Basic Application will be generated ๐
๐๏ธ Before we proceed, it is necessary to understand the structure of the main project we have created. Let's examine the accompanying image that explains the organization of The Main Project structure.
There are two folders in the main project: Supports and Target.
- The Support folder contains the InfoPlist and BridgingHeader folders. Each folder serves a specific purpose:
- The InfoPlist folder holds the Info.plist file, which can include various types of information as needed.
- The BridgingHeader folder contains a header file that facilitates interaction between Swift and Objective-C.
- The Target folder comprises the Resources, Sources, Tests, TestResources, and XCConfigs folders.
- The Resources folder manages the application's assets, such as images, colors, and localizable strings. TuistAutoGen automatically generates Image.xcassets and Color.xcassets catalogs within this folder.
- The Sources folder is where you can freely code your own logic.
- The Tests folder is designated for unit tests. TuistAutoGen strongly recommends performing tests and automatically includes the Test Library Quick and Nimble.
- The TestResources folder is where you can store resources specifically for testing purposes.
- The XCConfigs folder is used to manage any custom Xcode configuration files.
TuistAutoGen has four input options: main, includeOnly, include, and framework. Each option determines the type of project to be generated during project creation.
input Options | Explaination |
---|---|
--main |
a Main Application |
--includeOnly |
an Application base on Main Application |
--include |
an Application base on Main Application and also have own Sources and Resources |
--framework |
a Framework |
Now, you can use variety cases with these options!
Case 1) Let's assume that you want to create a main application and an includeOnly application.
./autoGenerator.sh --main $Main_ProjectName --includeOnly $Include_Only_ProjectName
The following folder structure will be created.
๐ฆTuistAutoGenerator
โ ๐ autoGenerator.sh
โฃ ๐ temp
โ ๐ Project
ย ย โ ๐ Main Application
ย ย โ ๐ IncludeOnly Application
Case 2) Let's create two includeOnly applications and one include application.
There is no problem at all. ๐
./autoGenerator.sh --main $Main_ProjectName --includeOnly $Include_Only_ProjectName_One --includeOnly $Include_Only_ProjectName_Two --include $Include_ProjectName
๐ฆTuistAutoGenerator
โ ๐ autoGenerator.sh
โฃ ๐ temp
โ ๐ Project
ย ย โ ๐ Main Application
ย ย โ ๐ IncludeOnly Application 1
ย ย โ ๐ IncludeOnly Application 2
Case 3) What about generating a framework?
./autoGenerator.sh --main $Main_ProjectName --framework $Framework_ProjectName
๐ฆTuistAutoGenerator
โ ๐ autoGenerator.sh
โฃ ๐ temp
โ ๐ Project
ย ย โ ๐ Framework
Now, let's explore what these options mean, their structure, and why they are necessary.
The --includeOnly
option provides a unique approach for project organization. It allows for the creation of a project structure that includes all folders from the Main project while keeping the "includeOnly" project itself devoid of sources and resources.
The necessity for the --includeOnly
option arises from its capacity to promote a cleaner, more organized project structure. It provides a way to include necessary components from the Main project without crowding the "includeOnly" project with additional resources or source files. This can be particularly useful for large-scale projects where different components need to reference shared resources, or when maintaining a lean project structure is of paramount importance. The --includeOnly
option simplifies navigation and management, and ensures a more streamlined project setup and maintenance process.
Consider the scenario where you're developing an application that has multiple variants - let's say, a "Dev" and a "Prod" version. Both versions share the same base structure and many resources, but the "Dev" version might include extra debugging tools, test data, or configuration settings.
In this case, the --includeOnly
option can be a powerful tool. Here's how it might work:
Your Main project includes all the source code and resources shared across both the "Dev" and "Prod" versions. This project forms the backbone of your application.
Next, you create an "includeOnly" project specifically for the "Dev" version. Using the --includeOnly
option, this project will include all the folders from the Main project but won't have its own sources or resources. Instead, it could contain specific debugging tools, additional configuration settings, or even test data exclusive for the development environment.
This setup allows you to easily switch between the "Dev" and "Prod" versions while keeping your project structure clean and organized. Each version has its own dedicated project but shares the same base structure and resources, ensuring consistency while allowing for version-specific customization.
The --include
option presents an effective method for project organization and resource allocation. When used, it instructs the include project to encompass all folders from the Main project while maintaining its unique sources and resources.
The need for the --include
option stems from its ability to promote a flexible, adaptive project structure. It facilitates the process of incorporating necessary components from the Main project, while allowing the include project to retain its individual resources and source files. This can prove highly beneficial for situations where different components of a project need to reference shared resources while still maintaining their own unique files.
For instance, imagine you are working on a project with multiple modules that share a common structure and resources but also require their own specific functionalities. Using the --include
option allows you to preserve this shared structure from the Main project while each module retains its unique capabilities.
The --include
option ensures that while the core structure remains consistent, there's room for individuality and customization where it's needed. It simplifies project navigation, management, and provides a more efficient workflow for developers.
The --framework
option signifies the creation of a project intended to be a framework. This framework will maintain its unique Resources, Sources, and include a sample application.
The necessity for a framework stems from its ability to encapsulate code into reusable, independent components. By using the --framework
option, developers can organize code in a way that promotes reusability, reduces complexity, and improves code maintainability. A framework can contain its specific Resources and Sources, allowing for a self-contained package of functionality that can be easily shared across multiple projects or applications.
For instance, imagine having a set of functionalities or services, such as networking or database management, that are used across different projects. By bundling these functionalities into a framework using the --framework
option, you can reduce code redundancy, streamline your development process, and increase the overall reliability of your code.
Moreover, a framework also comes with a sample application. This aids in testing the framework's functionality and serves as a practical example for developers to understand how to integrate and use the framework within their own projects.
In summary, the --framework
option plays a crucial role in creating a modular, organized, and maintainable codebase, which is a key aspect of modern software development methodologies.
With this, you are now primed to construct Tuist projects effortlessly using the powerful tool, TuistAutoGen.
As we reach the conclusion of this documentation, we invite you to explore the remarkable capabilities of TuistAutoGen. Utilize it as your catalyst to streamline the project creation process, bolstering your productivity and fostering an efficient development environment. Dive in, experiment, and discover the ease and efficiency TuistAutoGen brings to your Tuist projects. The future of effortless project creation is at your fingertips with TuistAutoGen. Enjoy your journey!
- ๐ฆ enabled to generate just only framework
- ๐ซฅ adjust auto codesign
- ๐๏ธ adjust tuist stencil
The MIT License (MIT)
Copyright (c) 2023 Hamin Song
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.