Chapter    3

Working with Strings and Collections

Chapter 2 introduced the basic structure of Swift and explained the different types, mutability versus immutability, and notable syntax changes, among other things. This chapter builds on that foundation of knowledge, focusing on creating and manipulating strings and collections of values.

Working with Strings

The Swift String value type is bridged seamlessly to Objective-C’s NSString class, meaning that any NSString method can be called on a String value, and a String value can be used with any API that expects an NSString instance. However, this does not mean that there is complete interchangability between String and NSString. For example, String methods such as toInt()(), computed properties ...

Get Transitioning to Swift 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.