0

Why use #import in objective c? if we use #include what happens?

1 Answers1

0

The #import directive was added to Objective-C as an improved version of #include. Whether or not it's improved, however, is still a matter of debate. #import ensures that a file is only ever included once so that you never have a problem with recursive includes. However, most decent header files protect themselves against this anyway, so it's not really that much of a benefit.

Source: @Jason Coco

Community
  • 1
  • 1
  • Keep in mind that #import and #include frequently won't include the whole file and when the rest of the file is required, #import won't be called again. – Anton Epikhin Mar 23 '16 at 07:39