Chapter 5

Swift and SwiftUI

IN THIS CHAPTER

Bullet Understanding the structure of Swift programs

Bullet Making comments

Bullet Declaring variables and constants

Bullet Using mathematical operators

Bullet Working with branching and looping statements

Bullet Creating functions, data structures, and objects

When the iPhone first came out, you couldn’t create apps for it. Developers pressured Apple into letting them create apps, and Apple finally relented and adopted Objective-C as the official language for creating iPhone apps.

Unfortunately, Objective-C can be just as difficult to learn as C++. That’s why in 2014, Apple introduced a much simpler, yet still powerful language called Swift. The main idea behind Swift is to offer a language that’s faster, safer, and easier than Objective-C. Because Swift is Apple’s official programming language, you should learn Swift if you plan to write apps for any of Apple’s various products ...

Get Beginning Programming All-in-One For Dummies, 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.