About me — Production Engineer at Shopify. — Building tools for mobile developers. — Born and raised in the ❤ Murcia. — Suffering the ☔ in Berlin. — # ppinera.es — $ @pepibumur — % [email protected] 2
A module can be — A library: If it doesn't have resources. — A framework: If it has them. — Static: If it's linked at compile time. — Dynamic: If it's linked at startup time. @pepibumur 6
Carthage & CocoaPods are two examples of tools that modularise your dependencies Carthage: Dynamic linking CocoaPods: Static & dynamic linking @pepibumur 10
// Module: Core public class Client: Clienting {} public class Logger: Logging {} public class Store: Storing {} public class SecureStore: SecureStoring {} // Module: CoreTesting public class MockClient: Clienting { public var executeCount: UInt! public var executeRequest: URLRequest! public var executeStub: (Any?, Error?)! } @pepibumur 36
1. Extract build se!ings into config files. 2. Extract foundation components/extensions. 3. Build new features in modules. 4. Gradually extract the existing features. ⚠ Extracting is not easy ⚠ @pepibumur 45
Tips to ease maintenance 1. Extract settings into .xcconfig files (a reusable single source of truth). 2. Automate the generation of Xcode projects (e.g. using XcodeGen). 3. Just Debug and Release configurations. @pepibumur 47
Catalisis (coming soon) — Command line tool. — Generates workspaces and projects for the module you are working on. — Caches modules to save time on CI and locally. — Offers an API to build/test modules. @pepibumur 50
Conclusions — Do it of you really need it. — (reuse or decouple code, save time) — More independent and productive teams. — Apple is also improving things. — It comes with some costs and lack of tooling (tools are optimized for monoliths) — A transition into modules is tough. @pepibumur 52