Should there be a link between the class name and the file name in which it resides?
OK, so I have 2 files (header and implementation) named MyLib.h
and MyLib.m
, inside those 2 files I have multiple classes, protocols and interfaces but none called 'MyLib'. Now, everything works just fine, I have only one problem, xCode doesn't show me any class hint except for MyLib
(which btw is only the name of the file, there is no My开发者_Go百科Lib
class).
Now, this small problem made me think about it, is this a bad practice? Is is better to have a file for each class and if yes, why?
I just created a .h
file with a different name from the class inside it, and Xcode gives me the completion for the class name, not the file name. Have you #import
ed the header wherever you're trying to use it?
精彩评论