I want to use Objective-C nullability feature. But should I annotate with nullable/nonnull implementation file or only interface?
The only reason to declare nullability is to have warning feedbacks from the compiler unit (see https://developer.apple.com/swift/blog/?id=25 ).
As a best practice, you should always set nullable and nonnull (or _Nullable and _Nonnull) in your declarations.
So you should do this for all your interfaces, but depending on your coding standards, you may implement class-scoped (or category-scoped) methods without declaring them, and in that case the declaration IS the implementation and you should declare their nullability values.
You always can declare nullability for implementations that are declared in interfaces, but in my opinion it degrades maintainability.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With