You may also find yourself in a situation where the generated names for your classes or methods are suboptimal. Thankfully, Clang provides macros that help us rename classes, methods, and more.
When you write Swift class names, we follow the recommendation of not prefixing our class names or extensions with a two or three letter code. However, back in Objective-C, those conventions are quite important for a number of reasons, but principally to avoid naming collisions with other objects from different frameworks.
Let's consider the following code snippet that defines a movie:
classMovie { let title: String let director: String let year: Int /* Initializers */ }
As it is right now, it is not possible to use it in Objective-C as the Movie
object doesn't inherit NSObject
. Also, because you're exposing your class to Objective-C and not following the naming conventions of Objective-C with the prefix, we should...