Support Types

In addition to classes, the Foundation framework includes several functions and types based on C structures. The NSTimeInterval type has already been mentioned. NSTimeInterval is implemented using the C double type. Structures that store points, sizes, and rectangles are defined in the Foundation framework. Another type used extensively is NSRange.

NSRange

NSRange is a C structure used to identify a location and a length. For example, an NSRange can be used to specify a range of characters to delete from a mutable string using NSMutableString’s –deleteCharactersInRange: method. The location is the index of the first character to delete. The length is the number of characters to delete. The NSRange structure is used by many Cocoa ...

Get Cocoa® Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.