sindresorhus / Defaults

💾 Swifty and modern UserDefaults
https://swiftpackageindex.com/sindresorhus/Defaults/documentation/defaults
MIT License
1.93k stars 115 forks source link

Macro ideas? #140

Open sindresorhus opened 1 year ago

sindresorhus commented 1 year ago

I wonder if we could use macros to simplify some things?

hank121314 commented 1 year ago

I would like to give Defaults+Extension.swift a shot. There is so much duplicate code that we should use macros to handle it!

sindresorhus commented 1 year ago

I was thinking more towards user-facing APIs. Not sure it's worth it for Defaults+Extension. Macros bring a lot of ceremony and obtuseness. It should be used sparingly to simplify things that are used very frequently. I can live with boilerplate inside Defaults. It won't change much going forward anyway. What I care about is simplifying Defaults public usage.

hank121314 commented 1 year ago

For user-facing APIs, I believe that having a macro that can automatically create bridges for user-custom types would be amazing!

sindresorhus commented 1 year ago

I believe that having a macro that can automatically create bridges for user-custom types would be amazing!

👍