Do nullability-related attributes in Objective-C normally used for Swift also apply to ObjC-ObjC calls?

43 views Asked by At

Reading up on the nullability-related attributes to decorate your Objective-C code for consumption by Swift clients. It's definitely a great feature and makes your APIs much cleaner when in the land of Swift.

However, what I'm wondering is if they can also be used to enforce proper usage in a purely Objective-C world (i.e. Swift is not part of the picture at all.)

In other words, if you mark an attribute in a function exposed in a library as nonnull but then consume it from Objective-C and pass nil into it, will the compiler warn you?

I ask because according to this article at apple which speaks about those annotations, in the 'Compatibility' section, it specifically says the annotations don't affect ABI. The next line does talk about how existing code that uses the framework may get new warnings when working on it, but I don't know if they mean Swift code or Objective-C code, and they do specifically mention the Swift compiler.

So again, do these attributes affect pure ObjC-to-ObjC calls?

enter image description here

0

There are 0 answers