I’m really interested in Sourcery, so I installed it in my one of repositories. In my case, I generated AutoEquatable and AutoHashable at first because I felt these implementations contain really a lot of boilerplate codes.


Here is an actual PR in EsaKit.

If I confirm to AutoEquatable or AutoHashable or both, Sourcery creates a needed function automatically like this.

  • AutoEquatable

  • AutoHashable

If I add a new property or a new API, it prevents a human error! Though it looks trivial, Sourcery uses a safe Hashable as I mentioned in Safe Hashable in Swift. Isn’t it cool?


Note to self:

I created a simple script for Sourcery, and then I run Sourcery command in this script. I had a Sourcery.swift file to define Auto*** commands like this.

If I move Sourcery.swift to /EsaKit/Sourcery.swift, Sourcery didn’t create any codes:( I didn’t know it has a such a specification until I have met this problem.
So I had to put in under the /EsaKit/Models like this /EsaKit/Models/Sourcery.swift because all structs confirmed to Auto*** is in Models.

EsaKit Tree

Please be careful about Auto*** files directory.

However, I totally recommend it. Sourcery saved a lot of repetitive works:)