orta / cocoapods-keys

A key value store for storing per-developer environment and application keys
MIT License
1.55k stars 92 forks source link

Nullability annotations for generated Objective C keys classes #154

Closed Skogetroll closed 7 years ago

Skogetroll commented 7 years ago

Is it possible to add nullability annotations for generated classes?

It would mainly help Swift developers, because it would be easier to guess either keys.someKey() always returns value or can return nil.

orta commented 7 years ago

Sure, send a PR

Skogetroll commented 7 years ago

Done: https://github.com/orta/cocoapods-keys/pull/155

Also, is there any reason why keys are methods and not a properties?

For Objective C both are almost interchangable in calling syntax, but for Swift there's difference, small (methods have parenthesis and properties don't), but still. And all those generated key code looks more like readonly properties than methods.

So maybe change like this is preferrable?

- - (NSString *)<%= key %>;<% end %>
+ @property (readonly) NSString *<%= key %>;<% end %>
orta commented 7 years ago

I think this was because of some runtime hackery, can't remember anymore 👍

Give it a shot, and if it works, I'm happy to have it as properties

Skogetroll commented 7 years ago

157 : I guess, runtime hackery were prevented because of auto-generated getter, but with @dynamic everything works fine.