Strings

The other major framework we import by default in iOS projects is Foundation, which provides fundamental data types for common concerns like dates and times, regular expressions, file I/O, and so on. We’ve already used two classes from Foundation: the NSURL and NSURLRequest that we used to populate the UIWebView.

Foundation also provides strings (as the NSString class) and collections (NSArray and NSDictionary), and in Objective-C, we would work with these as we would with any other class. However, in Swift, the language has taken more responsibility for strings and collections, and we can do a lot of common tasks without having to explicitly call methods on object instances. This makes Swift a lot easier to just get in and use.

Get iOS 8 SDK Development, 2nd Edition 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.