Skip to content

Latest commit

 

History

History
110 lines (71 loc) · 4.22 KB

README.md

File metadata and controls

110 lines (71 loc) · 4.22 KB

The Composable Microfeature Architecture

This little project is an opinionated, yet simple tool, that leverages the work of two excellent open-sourced projects namely Tuist and TCA (The Composable Architecture). The aim of this little project is to help you get started building a scalable and modular application immediately without all the boilerplate.

The MicroFeatures Architecture

The MicroFeatures Architecture or uFeatures is an architectural approach to structure Apple OS applications to enable scalability, optimize build and test cycles, and ensure good practices in your team. Its core idea is to build your apps by building independent features that are interconnected using clear and concise APIs.

Learn more

The Composable Architecture

The Composable Architecture (TCA, for short) is a library for building applications in a consistent and understandable way, with composition, testing, and ergonomics in mind.

Learn more

By combining the two architectures, we get something that is easy to use, easy to follow, and most importantly modular and thus scalable among teams.

This little project requires that you are both familiar with TCA, and Tuist.

How to get started?

Install Tuist with the following command:

bash <(curl -Ls https://install.tuist.io)

Now to get started run the following command in your terminal:

tuist scaffold generate --name YourProjectName

This will bootstrap your iOS application. You can now edit your project by running the following command and see all the code provided by this little project:

tuist edit

Finally to get started run the following command:

tuist generate && tuist focus YourProjectName

Creating Microfeatures

Now we can start creating Microfeatures. Microfeatures allow you to write features in isolation without having to create and write boilerplate code.

You can create a MicroFeature using the following command:

tuist scaffold feature --name YourFeatureName

Now you need to write a little code to add the feature to your project. First type the following command:

tuist edit

And then add your feature to the project as follows:

...

let additionalTargets: [Project.Framework] = [
    .remote(info: .init(name: "ComposableArchitectureFramework",
                        organisationName: organisationName,
                        platform: platform,
                        dependencies: ["ComposableArchitecture"])),

    .feature(info: Project.FeatureInfo(name: "YourFeatureName",
                                       organisationName: organisationName,
                                       platform: platform,
                                       dependencies: ["ComposableArchitectureFramework"],
                                       testdependencies: ["ComposableArchitectureFramework"]))
]

...

Finally run the following command to regenerate your project:

tuist generate

Now you can either open the the workspace and plugin your feature, or you can run and write the feature in isolation with the following command:

tuist focus YourFeatureName

Checking out the example Todo project

If you are a little unsure how everything fits together, you can checkout the example project, by typing out the following command:

tuist scaffold example

This will generate a fully functional Todo example project together with tests. This is the original TCA todo example that is using the Microfeatures architecture

References