2019-09-25 TIL

2019-09-25

Objective C 의 import

#import “헤더파일” : 직접 작성한 헤더 파일의 모든 코드를 가져오되, 중복 import는 무시해줌 (#include와 차이점)

#import <프레임워크/헤더파일> : 프레임워크의 헤더 파일을 가져옴. 중복 import는 무시해줌

@import 프레임워크 : 프레임워크를 가져옴. 중복 import는 무시해줌

@import 프레임워크.모듈 : 코드 전체가 아닌 특정 모듈만 가져옴. 컴파일 속도 증가

reference: https://medium.com/@jang.wangsu/ios-objc-include-import-import-%EB%9E%80-443940eb63da

  • "" 는 로컬 include. 경로를 포함해 적어야 함
  • <> 는 글로벌 include. 컴파일러에 경로를 알려줘야 함

reference: https://stackoverflow.com/questions/1044360/import-using-angle-brackets-and-quote-marks

One of the big advantages of using @import is that you don’t need to add the framework in the project settings, it’s done automatically.

reference: https://stackoverflow.com/questions/18947516/import-vs-import-ios-7


Minchang Kim
Minchang Kim
웹/앱 개발자 김민창입니다! 좋은 하루 되세요!