What is the difference between #import and #include in Objective-C?

前端 未结 10 1514
小蘑菇
小蘑菇 2020-11-22 10:12

What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated?

I was reading th

10条回答
  •  没有蜡笔的小新
    2020-11-22 11:00

    #include + guard == #import
    

    #include guardWiki - macro guard, header guard or file guard prevents to double include a header by a preprocessor that can slow down a build time

    The next step is

    .pch[About] => @import[About]

    [#import in .h or .m]

提交回复
热议问题