© Wallace Wang 2017

Wallace Wang, macOS Programming for Absolute Beginners, 10.1007/978-1-4842-2662-9_12

12. Defining Custom Data Types

Wallace Wang

(1)San Diego, California, USA

To store data, Swift provides common data types such as integers (Int), decimal numbers (Float or Double), and text (String). In addition, Swift also offers Boolean data types (Bool) for holding true or false values.

While nearly every program will need to use one or more of these Swift data types, you may find them too limiting. That’s why Swift provides several ways to create your own data types based on the basic Swift data types. In addition, Swift offers several ways to organize basic data types (Int, String, Double, etc.) in unique ways. Defining different ways to ...

Get macOS Programming for Absolute Beginners: Developing Apps Using Swift and Xcode 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.