This is the third part of a mini series where I share lessons from my day job. This time it's all about how I take a repo where all its code is in the main iOS target and modularize it using local SPM packages.
In this way, I can easily:
- reuse code in different targets
- work isolated in modules with faster speed of iteration
- have clear boundaries between modules of the app
The full sample code from this video can be found in:
- Initial state: https://github.com/fespinoza/Youtube-SampleProjects/tree/movie-catalog-routing/00-routing-and-deep-links
- End state: https://github.com/fespinoza/Youtube-SampleProjects/tree/movie-catalog/modularize-into-spm-packages
#swiftUI #spm #swift #iOS #architecture #modularization
*Amazon Links are affiliate links
--------------------------------
👋 You can find me in
--------------------------------
- BlueSky: https://bsky.app/profile/fespinozacast.bsky.social
- Github: https://github.com/fespinoza
- BuyMeACoffee: https://buymeacoffee.com/craftingswift
--------------------------------
📸 Camera Gear
--------------------------------
- Camera: Sony A6700 (https://amzn.to/4iYkLYR)
- Lens: Sigma 16mm 1.4 for Sony E (https://amzn.to/4bYAmFz)
- Elgato Prompter (https://amzn.to/3A2ZLiY)
- Key light: Godox ML100Bi (https://amzn.to/41YCW9Y)
- Mic #1: DJI mic 2 + DJI lavalier mic (https://amzn.to/4hL8F4m)
- Mic #2: Elgato Wave DX + Elgato Wave XLR (https://amzn.to/4hjvbSR)
- M1 Max Macbook Pro (https://amzn.to/3NG5ZIv)
- Screen Recording: CleanShot X
--------------------------------
📖 Reading Tools
--------------------------------
I have an affiliate link, but I honestly recommend trying readwise. I like how helps you remember what you read. The reader app is excellent for articles too!
https://readwise.io/craftingswift/ It gives you an extra month of your trial period
--------------------------------
🏷️ Chapters:
--------------------------------
00:00 - 1. Intro
00:54 - 2. Why Divide
01:50 - 3. How do we divide
03:57 - 4. Example
04:15 - 4.1. The Plan
05:52 - 4.2. Extract Base Models
07:11 - 4.3. Networking Package
07:49 - 4.4. Navigation
09:31 - 4.5. Feature Package
10:48 - 5. Conclusion