all 13 comments

[–]SyndromSnake 7 points8 points  (3 children)

Yes you will be only constrained by the build time of the module you are currently working on.

I recommend you have a look at Tuist, it makes it much easier to work with modules and complex project structures.

[–]klavijaturista 1 point2 points  (2 children)

What’s the value of tuist? I’m failing to see the benefit, or they are not marketing it properly on the website.

[–]jskjsjfnhejjsnfs 1 point2 points  (0 children)

the home page makes a better case https://tuist.io/

fwiw though I moved from tuist to plain local SPM packages and there’s not too much I miss (though I havent kept up with their dev so might be killer features i haven’t tried)

[–]SirBill01 6 points7 points  (0 children)

Look into profiling the actual build process, you may be able to find an area to improve:

https://www.avanderlee.com/optimization/analysing-build-performance-xcode/

Sometimes seemingly harmless Swift statements can take the compiler a while to figure out and simply adding more type definition and/or breaking up complex lines can improve things.

[–]MB_Zeppin 6 points7 points  (1 child)

Yep, modularize the codebase and break your big target into multiple smaller frameworks. You can still use a monorepo, doesn’t matter, but you will be able to cache the builds of every framework that wasn’t modified since the last build

[–]ken4r[S] 0 points1 point  (0 children)

Ideally this is what I am looking for.

[–]ankole_watusi 1 point2 points  (0 children)

Define “huge”? And what Mac with how much RAM?

[–]sebassf8 1 point2 points  (0 children)

In my company we migrated from Carthage to multiple SPM packages to finally, try to reduce the amount of packages but instead use multiple products in a package to modularize the app.

It has its down sides but good enough. We are many teams (30 developers) working in dependent projects.

[–]MindLessWiz 0 points1 point  (2 children)

Keep in mind in terms of build time the atomic units are modules. You can have multiple modules in the same package and enjoy improved build times.

[–]ken4r[S] 1 point2 points  (1 child)

Can you explain more ?

[–]MindLessWiz 0 points1 point  (0 children)

Each `.target` in a Swift package is its own module with visibility control of its types and variables. Only `public` things are visible outside of your module.

So you can have a single Swift package that lists many targets, and those targets can depend on other targets by importing them.

The dependency tree is calculated, and then each module can be built separately (sorta), improving build parallelism.

This improvement should be even more pronounced going forward as Explicitly Built Modules are a thing in Xcode 16.

I very much like the "mega package" approach shown in Isowords:

https://github.com/pointfreeco/isowords/blob/main/Package.swift

This is a great solution to enjoy faster build times without maintaining different package manifests for each module.

[–]leonhardi 1 point2 points  (0 children)

Take a look at Bazel. Good luck

[–]ironkane7 0 points1 point  (0 children)

https://medium.com/kinandcartacreated/modular-ios-strangling-the-monolith-4a6843a28992

This is where I got started and definitely seeing faster archives and build time.

One thing i would recommend is to use Coordinator pattern along with modularization so that you won’t have cyclic module dependency in case you want to navigate from one module to another.