更新时间:2021-07-02 22:56:11
coverpage
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Hello macOS
It's going to be Swift
And more than Swift
It's going to be Xcode and more
Prerequisites
The book's overall structure
How Unix macOS Cocoa and AppKit fit together
Darwin
macOS
Cocoa
Harnessing that power
The serious developer's toolkit
What you'll get from this book
Summary
Basic Swift
Variables and types
Number types
Integers
Booleans
Strings
Printing to the console
Comments
Arrays dictionaries and sets
Arrays
Dictionaries
Sets
Naming of types and variables
Type aliases
Value and reference types
Operators
Mathematical operators
Augmented assignment
Comparison operators
Logical operators
Other standard operators
Ternary operator
Nil-coalescing operator
Structs classes and other data structures
Structs
Classes
Optional instances
Tuples
Enumerations
Optionals
Why use optionals?
Unwrapping an optional
Control flow
if else
switch
Loops
Saying goodbye to i++
Iterating with for loops
while
Functions
Checking Out the Power of Xcode
A quick and simple sketch app
Speeding it up with code snippets
Checking out the supplied snippets
Usage
Rolling your own snippets
Logging with special literals
Getting the most out of breakpoints
Editing breakpoint options
Other actions
Adding a debugger command
Triggering an AppleScript or shell script
Don't stop me now
Behaviors
Understanding schemes
What schemes actually do
Creating a new scheme
Using scheme environment variables
Why build configs are so cool
Creating a new build configuration
Creating user-defined build settings
Adapting the Info.plist file
Using Swift compiler custom flags
Creating the custom flag
Using custom flags in code