What is the difference when using @class or #import in objective-c?
I have seen various tutorials and only a few use @class while most of the others use #import.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
@classdoesn’t import the file, it just says to the compiler “This class exists even though you don’t know about it, don’t warn me if I use it”.#importactually imports the file so you can use all the methods and instance variables.@classis used to save time compiling (importing the whole file makes the compile take more time). You can use#importif you want, it will just take longer for your project to build.