What should I do if a new iOS version introduces possible class collisions (Apple classes with the same prefix as mine)?

| | August 10, 2015

I’m dealing with this problem in iOS 8.3, where a new set of classes have been introduced that could potentially conflict with my classes because they use the same prefix. Should I worry? Should I use prefixes at all, or should only frameworks/libraries use them? Can I refactor all class names at once if needed?

2 Responses to “What should I do if a new iOS version introduces possible class collisions (Apple classes with the same prefix as mine)?”

  1. Always prefix your class name with your company/app name whenever you create the class. Personally I prefer 3 characters instead of 2 characters, since Apple has the right to prefix their class name with 2 letters.

    For example, if you have a class named CoreData and your company name is Foo Bar, your app is called Rabbit, name the class “FBRCoreData” instead of “CoreData”.

    I suppose your best practise would be renaming your class names (all of them if possible ) with the prefix. Otherwise it may bite you again later.

  2. Just go with the safer option of prefixing your classes. This will then mean you never need to worry about this problem again.

Leave a Reply