theme: Stream slidenumbers: true slidecount: true
- Software developer since 2002, iOS since SDK v. 3
- Worked on several apps B2C, B2B
- ING Banking, Nyon, Achmea, SurfNet, Multiple small apps
- CocoaHeadsNL apps
- Team lead role 2018 - 2021
- Wrote a book based on my experience
- Since November 2021 Developer Relations Engineer iOS at Stream
- What?
- Micro/feature frameworks and apps
- Why?
- Compile time
- Reflect team structure and responsibilities
- How?
- Using Frameworks
- Many targets
- Tool support
First of all, is there a difference?
I think it is interchangeable and mostly depends on what you are comfortable with.
It is a way of thinking and structuring your project.
Based on the concept of microservices.
You split your implementation in a way that makes sense to you.
Each feature could be implemented by these frameworks:
- Source
- Interface
- Tests
- Testing
- Example
- Compile time
- Separation of concerns, battle scaling issues
- Allows for defining API levels and boundaries
- Let's be honest.
- You also define way to much as being public or have default scope
- Many codebases is one big pile of sourcecode
- When compiling, all your code and dependencies are in scope during compilation and linking
- Lots and lots of work
- When compiling, all your code and dependencies are in scope during compilation and linking
-
Creating frameworks decreases the amount of code that can "see" each other during compilation.
- Provided you put some constraints in place.
- Default scope helps you here, since it is package private
- Provided you put some constraints in place.
-
Just creating and properly scoping your Frameworks potentially cuts your compile time in half. If not more. No joke.
Having scaling issues within a codebase/project is a good thing
- But how do you reflect team boundaries in you code?
- How to separate features in your code?
With Frameworks 😄
You can also use Frameworks to clearly define API levels and boundaries
- Besides features, create frameworks for
- networking
- authentication
- storage
- etc.
- Easy encapsulation and isolation of
3rd party dependencies
- Put it in a framework and do not call on it directly from anywhere BUT the framework
- When using frameworks scope becomes much more useful
- Code level API documentation integrated very well in Xcode.
- Easy caching and pre-building of parts of the entire codebase
Did you ever create a Framework in Xcode manually?
It takes some effort right?
Creating Frameworks manually is very tedious and error prone.
How to
- do it right
- keep things consistent
- make sure it is easy to create additional Frameworks?
- CLI
- Generates Xcode projects
- Define you project structure and settings in Swift
- No more Xcode project file conflicts, ever.
Let's have a look at Tuist and see how simple it is
^ mkdir demo
^ tuist init --platform ios
^ tuist generate
Do you remember this picture?
Let's see how this looks in Tuist.
- We talked about
- Feature Framework clusters
- Feature composition
But each feature is composed of several Feature Framework specific Targets
- Source, Interface, Tests, Testing, Example
Remember these two? Let's combine these two…
This should result in 30 targets.
^ Open full sample
^ tuist edit
^ tuist graph
^ tuist graph -t
^ tuist generate --open
^ Show overview
- Templates and abstraction
- This is where all of your Swift skills come in
Both are great tools. But they are also complex.
Tuist fills the gap between straight forward Xcode projects and having budget to create dedicated teams to support your builds.
I have looked at all three. Tuist has the deepest and best integration with tools surrounding Apple's Xcode IDE.
We at Stream think Tuist is a great idea. We now sponsor the ongoing development of Tuist.
Check them out, learn about their approach, unlock true scaling of your Xcode based codebase.
References
https://tuist.io/ https://docs.tuist.io/building-at-scale/microfeatures https://increment.com/mobile/microapps-architecture/ https://github.com/AppForce1/talk-micro-frameworks