Why does Xcode autocomplete offer .m files upon import?

Just wondering -

When you start typing #import "

Xcode offers .m and .h files. I just had a few hours of disappointment after importing the .m file incorrectly.

Is this a bad design? Can you import .m files?

+6
source share
1 answer

You can import any files. #import is just a preprocessor directive that basically says: "Include the contents of the file in which I will tell you in the current file." There are some defenders, but import does just that - it imports the file that you tell it to.

Importing a header with a .h file is probably more a convenience / convention (please don't beat me up for this, I just guess) unless there is some C / C ++ standard that says otherwise.

+1
source

Source: https://habr.com/ru/post/973036/


All Articles