A delicious, quality‑of‑life supplement for your app‑development toolbox.
We are aware of Xcode 11, probably don’t commit to Cake at this time
Modules are a powerful Swift feature, yet existing tooling makes modulizing your
projects so tedious that most people don’t bother.
A modular app gains:
internal
access control.@testable
making the functionalityCake makes working with Swift modules a breeze.
Supporting Swift tools-version-5 and tools-version-4 is not our thing. Cake
requires at least Xcode 10.2 to function.
Hey there, I’m Max Howell, a prolific producer of open source software and
probably you already use some of it (I created brew
). I work full-time on
open source and it’s hard; currently I earn less than minimum wage. Please
help me continue my work, I appreciate it 🙏🏻
“The secret of getting ahead is getting started. The secret of getting started
is breaking your complex overwhelming tasks into small, manageable tasks, and
then starting on the first one.” —Mark Twain
Cake is an app that runs in your menu bar and watches your Xcode projects. If
you chose to integrate Cake into your App’s xcodeproj it will automatically
generate your module hierarchy based on your directory structure. For example:
.
└ Sources
└ Model
├ Module1
│ ├ a.swift
│ └ b.swift
└ Module2
├ c.swift
└ d.swift
Now ⌘B and you’ll be able to import
:
import Module1
import Module2
FAQ: What is a cake project? A Cake project has a
Cakefile.swift
file
in its root.
Delicious: All your modules are built statically so there’s no
launch-time consequences.
Curious? Cake is made with Cake, so is Workbench, check out the sources
to see more about what a cake‐project looks like.
Details: Cake generates a sub-project (Cake.xcodeproj), you lightly
integrate this into your app’s project.
“You’ve got to think about the big things while you’re doing small things, so
that all the small things go in the right direction.” —Alvin Toffler
Before long you will need some modules to depend on others. This is an important
step since you are starting to acknowledge the relationships between components
in your codebase. Cake makes declaring dependencies as easy as nesting
directories.
.
└ Sources
└ Model
└ Base
├ a.swift
├ b.swift
└ Foo
├ c.swift
└ d.swift
Here Foo
depends on Base
and thus, Foo
can now import Base
.
All other tools require you to specify relationships cryptically, either
textually or with a confounding GUI. With Cake, use the filesystem,
relationships are not only easy to read, but also, trivial to refactor (just
move the directory).
Further Reading: Advanced module hierarchies
FAQ: What should go in your
Base
module? Cake’sBase
module contains
extensions on the standard library.
“You can do anything, but not everything.” —David Allen
Cake makes using Swift packages in Xcode easy. Write out your
Cakefile
, ⌘B, Cake fetches your deps and
integrates them: no muss, no fuss.
import Cakefile
dependencies = [
.github("mxcl/Path.swift" ~> 0.8),
.github("Weebly/OrderedSet" ~> 3),
]
// ^^ naturally, using Cake to manage your deps is entirely optional
We figure out your deployment targets, we make your deps available to all your
targets and we generate a stub module that imports all your deps in one line
(import Dependencies
).
We check out your dependencies tidily, for example the above Cakefile
gives
you:
.
└ Dependencies
├ mxcl/Path.swift-0.8.0
│ ├ Path.swift
│ └ …
└ Weebly∕OrderedSet-3.1.0.swift
Which generates this in your Cake.xcodeproj
:
Which you can then commit, or not commit: that’s up to you.
Though we suggest you do.
Delicious: All dependency modules are built statically so there are no
launch-time consequences.
Delicious: A fresh clone of a Cake project builds with vanilla Xcode,
no other tools (even Cake) are required. Distribute away without worry!
Delicious: Cake finally makes it possible to use SwiftPM packages for iOS
development!
Caveat: We only support SwiftPM dependencies at this time.
Further Reading: Cakefile Reference
If your app uses Carthage or CocoaPods we detect that and integrate them so
your cake modules (the Batter
) can use these dependencies.
Note, this only applies to cake modules (the Batter
); for your App target
follow the instructions provided by CocoaPods and Carthage themselves; nothing
is different.
CocoaPods and Carthage libraries tend to be on the large side, and this is at
least partly because being modular has been historically hard and tedious when
developing for Apple platforms and Swift. SwiftPM encourages smaller, tighter
frameworks and using Cake means making apps with Swift packages is now possible.
Choose small, modular, single‐responsibility libraries with 100% code coverage
that take semantic-versioning seriously. Reject bloated libraries that don’t
know how to say no to feature requests.
Since everything Cake builds is a static archive, you can simply link whichever
parts you like into whatever Frameworks or dylibs you need for your final
binaries.
This is a purely optional step, statically linking Cake.a
into your App (which
Cake sets up by default for you) is perfectly fine. This more advanced option is
available to make apps with extensions more optimal in terms of disk usage and
memory consumption.
Run it.
Check your menu bar:
Open a project and integrate Cake; or
Create a new Cake.
Delicious: We auto-update!
Cake determines your App’s version from your git tags, to use them simply
set each target’s “Version” to: $(SEMANTIC_PROJECT_VERSION)
and if you
like the “Build” number to: $(CURRENT_PROJECT_VERSION)
.
Delicious! We even append
-debug
to debug builds.
Due to some Xcode bugs Cake is not a complete Cake‐walk in use. Please see our
troubleshooting guide for details.
Icons made by Google and
Freepik from
www.flaticon.com licensed by
CC 3.0 BY.