I would like to split code up from a view controller into categories for multiple coders to work on the view controller without editing the same file. I get the following warning when making the category:
"Category is implementing a method which will also be implemented by its primary class"
my category .h file:
#import "MyClass.h"
@interface MyClass (CategoryName)
@end
my category .m file:
#import "MyClass+CategoryName.h"
@implementation MyClass (CategoryName)
-(void) methodThatIsUsedAndExposedByMyClass { //a class that is made public by declaring in MyClass.h
}
@end
I instance MyClass in view controller MyOtherClass. What is the proper way to setup/import MyClass.h into MyOtherClass without exposing the category to it and without getting the warning?
Honestly, given that the crux of your concern is developer workflow, you should probably look for a solution that’s based in workflow rather than in code. Have you looked at git (http://git-scm.com)? It’s a decentralized version control system, and it’s generally really good about automatically merging changes from multiple sources. As long as each developer is working on a different part of the code, they can all make changes to the same file without causing problems.
What git is less good at is merging multiple changes to auto-generated files like project.pbxproj. But that’ll only come up sometimes when adding and removing files — when two or more people are modifying the same .m file, all you have to do is
git pulland thengit push, and it will calculate insertions and deletions for you.There probably are ways to do what you’re asking about with categories, but at best, you’d be making your code less readable in order to serve a purpose that has nothing to do with the code. Version control systems take some getting used to, but they’re totally worth it when you’re on a multi-developer team.