更新时间:2021-07-02 15:06:03
coverpage
Title Page
Copyright and Credits
iOS 12 Programming for Beginners Third Edition
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Getting Familiar with Xcode
Getting started
The Xcode interface
Navigator panel
Standard editor
Utilities panel
Debug panel
Toolbar
Generic iOS device
iOS device
Connecting wirelessly
Window pane controls
Summary
Building a Foundation with Swift
Playgrounds – an interactive coding environment
Data types – where it all starts
String
Integer data type
Floating-point numbers
Booleans
Variables and constants – where data is held
Creating a variable with a string
Creating a variable with an integer (int)
Debug and print() – detecting your bugs
Adding floating-point numbers
Creating a Boolean
Why constants versus variables?
Comments – leaving yourself notes or reminders
Type safety and type inference
Concatenating strings
String interpolation
Operations with our integers
Increment and decrement
Comparison operators
Building on the Swift Foundation
Creating a Playground project
The if statements – having fun with logic statements
Optionals and optional bindings
Why optionals?
Functions
Digging Deeper
Ranges
Closed range
Half-closed range
Control flow
The for...in loop
One-sided range
The while loop
The repeat...while loop
Digging into Collections
Arrays
Creating an empty array
Creating an array with initial values
Creating a mutable array
Adding items to an array
Checking the number of elements in an array
Checking for an empty array
Retrieving a value from an array
Iterating over an array
Removing items from an array
Dictionaries
Creating a dictionary
Adding and updating dictionary elements
Accessing an item in a dictionary
Iterating over dictionary values
Iterating over dictionary keys
Iterating over dictionary keys and values
Checking the number of items in a dictionary
Removing items from a dictionary
Sets
Creating an empty set
Creating a set with an array literal
Creating a mutable set
Adding items to a set
Checking whether a set contains an item
Iterating over a set