售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Beginning Swift
Why Subscribe?
PacktPub.com
Contributors
About the Authors
Packt is Searching for Authors Like You
Preface
What This Book Covers
What You Need for This Book
Who This Book is for
Conventions
Note
Tip
Reader Feedback
Customer Support
Downloading the Example Code
Errata
Piracy
Questions
Chapter 1. Swift Basics
Lesson objectives
Swift Program Structure
Hello, World!
Note
Swift Variables and Constants
Declaring Swift Variables
Note
Variables Versus Constants
Note
Type Inference
Variable Naming
Note
Working with Variables
Tuples
Note
Creating a Tuple
Optionals
Note
Declaring an Optional
Note
Working with Optionals
Optional nil Values
Accessing Optional Values
Force Unwrapping an Optional
Note
Conditionally Unwrapping Optionals
Using Optionals
The Swift guard Statement
Activity: Variable Summary
Swift Data Types
Note
Numeric Data Types
Int on 64-Bit Versus 32-Bit Platforms
Built-In Numeric Data Types
Choosing the Appropriate Numeric Data Type
Note
Declaring and Assigning Integer Variables
Declaring and Assigning Floating Point Numbers
Numeric Literal Grouping
Numeric Type Conversions
Note
Using Numeric Types
Boolean
Character
Assigning a Character
Constructing a Character Literal
String
Instantiating a String
String Concatenation
Extracting Characters
String Length
Activity: Data Type Summary
Enums
Basic Enum Syntax
Enum with Raw Values
Note
Activity: Using Swift Enums
Summary
Chapter 2. Swift Operators and Control Flow
Lesson objectives
Swift Operators
Assignment Operator
Arithmetic Operators
Standard Arithmetic Operators
Remainder Operator
Note
Unary minus Operator
Compound Assignment Operators
Comparison Operators
Equality
Inequality
Comparison between Two Values
Ternary Conditional Operator
Logical Operators
Bitwise Operators
Nil-Coalescing Operator
Range Operators
Closed Range Operator
Half-Open Range Operator
One-Sided Range Operator
Activity: Operators
Branching
The if Statement
Condition Lists
Note
Optional Unwrapping with if
The switch Statement
switch Statement Rules
The break Keyword
The fallthrough Keyword
Matching Non-Scalar Values
Multiple Patterns in a Single Case
Using the where Statement within case
Evaluating Optionals with a switch Statement
Activity: Converting Code from if to switch
Loops
The for…in Statement
Note
Iterating over Objects
Note
Iterating over Array Objects with index
The for Loop where Clause
The break Control Transfer Statement
The continue Control Transfer Statement
The while Loop
The repeat…while Loop
Note
Activity: Implementing Loops
Summary
Chapter 3. Functions, Classes, and Structs
Lesson Objectives
Functions
Defining a Function
Argument Labels
Excluding Argument Labels
Note
Parameter Default Values
Activity: Implementing a Function
Returning Values from Functions
Using @discardableResult
Note
Function Attributes
Variadic Parameters
inout Parameters
Recursion
Functions as Parameters
Closures
Creating a Function to Receive Content from an Asynchronous Web Service Call
Error Handling
The do…catch Statement
Multiple catch Blocks
Using do without catch
The guard Statement
Note
Activity: Exception Handling
Object-Oriented Features
Object-Oriented Principles
Classes Versus Structs
Illustration
Defining Classes and Structures
Activity: Creating a Customer Struct and Class
Summary
Challenge
Chapter 4. Collections
Lesson Objectives
Arrays
Working with Arrays
Index
Common Operations with Index
Note
ArraySlice
Creating Slices
Activity: Working with Arrays
Sets
Note
Working with Sets
Combining Sets
Comparing Sets
Activity: Removing Duplicates from a Sequence
Dictionaries
Working with Dictionaries
Activity: Using Dictionaries
Summary
Chapter 5. Strings
Lesson Objectives
String Fundamentals
Character
Note
Note
Collection
Note
Index
Working with String Index
Debugging
Activity: All Indices of a Character
Using Strings
Creating Strings
Common Operations
Activity: All Ranges of a Substring
Activity: Counting Words, Sentences, and Paragraphs
Substring
Creating Substrings
Parsing Strings
Converting NSRange to Range
Activity: CamelCase
Summary
Chapter 6. Functional Programming and Lazy Operations
Lesson Objectives
Function Type
Note
Functional Methods
Note
Note
filter
Using the filter Method
map
Using the map Method
flatMap
Using the flatMap Method
reduce
Using the reduce Function
Activity: Using Functional Programming
Note
Lazy Operations
Lazy Sequences
Note
Note
Sequence Internals
Note
Creating Lazy Operations
Note
sequence(first:next:)
sequence(state:next:)
Note
Activity: Implementing a Lazy Version of a Method
Note
Swifty Code
Naming
Organizing Code
Miscellaneous
Writing Swifty Code
Summary
Further Study
Challenge
Index
A
B
C
D
E
F
G
H
I
L
M
N
O
R
S
T
U
V
W
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜