2016년 4월 6일 수요일

[ios][objective-c] 접두사 NS가 붙는 이유 (prefix NS)

iOS 개발을 하다보면 클래스 이름에 NSString, NSSet과 같이 접두사(prefix) NS가 붙어있다.

애플 개발자 문서에 이렇게 설명되어 있다.

Historical Note: If you’re wondering why so many of the classes you encounter have an NS prefix, it’s because of the past history of Cocoa and Cocoa Touch. Cocoa began life as the collected frameworks used to build apps for the NeXTStep operating system. When Apple purchased NeXT back in 1996, much of NeXTStep was incorporated into OS X, including the existing class names. Cocoa Touch was introduced as the iOS equivalent of Cocoa; some classes are available in both Cocoa and Cocoa Touch, though there are also a large number of classes unique to each platform. Two-letter prefixes like NS and UI (for User Interface elements on iOS) are reserved for use by Apple.

애플사가 NextStep(NS)사를 인수했는데 이때 클래스 이름들이 중복되지 않아야 해서 NS라는 접두사를 붙였다고 한다.

Source: Programming with Objective-C

댓글 없음:

댓글 쓰기