As i am following the book on Objective-C, i, my mistake ran into
duplicate symbol _OBJC_METACLASS_$_ClassName error, which was quickly resolved once i realized i imported the .m file instead of intended .h.
This got me thinking:
- In Objective-C, would you ever import a non header file like
.m? - Is there a reason Xcode suggests both options (
.hand.m) as part of it’s autocomplete?
As you can see #import will just replace the import with contents of the file imported. The reason why XCode offers the .m file as part of its autocomplete is because it just grabs every file in the directory to populate the list. A header file could have any extension other than .h but would confuse developers as to its purpose.