Sourcery
What is Sourcery
Source: https://github.com/krzysztofzablocki/Sourcery Sourcery is a tool that allowed us to generate boilerplate code from our Swift code.
The advantages of using Sourcery
- Reduce our work to write boilerplate code (Codable, CasePath, Memberwise Initializer, Lens, Prism etc).
- Safety. It doesn’t use runtime tricks. Sourcery generate swift code that is checked by compiler.
- Able to write custom template that’s suitable for developer need
How to use Sourcery
Install with brew
brew install sourcery
Writing custom template
If you want to write custom template to generate Swift code, Sourcery comes with file watcher. Using this file watcher, you can write template and sourcery will generate automatically.
Linked Notes:
Today I learn
I believe that we can learn something new everyday, that’s why I set this page to record what I learn during the day.