更新时间:2021-07-02 23:55:18
封面
版权信息
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
Getting Started with Functional Programming in Swift
Why functional programming matters
What is FP?
The Swift programming language
Swift features
Modern syntax
Type safety and type inference
Immutability
Stateless programming
First-class functions
Higher-order functions
Closures
Subscripts
Pattern matching
Generics
Optional chaining
Extensions
Objective-C and Swift bridging headers
Automatic Reference Counting
REPL and Playground
Language basics
Types
Type inference
Type annotation
Type aliases
Type casting
Tuples
Optionals
Basic operators
Strings and characters
String literals
Empty Strings
Concatenating strings and characters
String interpolation
String comparison
Collections
Control flows
for loops
while loops
The stride functions
if
Switch
Guard
Functions
The map filter and reduce functions
The map function
The filter function
The reduce function
Enumerations
Classes and structures
Classes versus structures
Choosing between classes and structures
Identity operators
Properties
Property observers
Methods
Inheritance
Initialization
De-initialization
Any and AnyObject
Nested types
Protocols
Protocols as types
Protocol extensions
Access control
Error handling
Summary
Functions and Closures
What is a function?
Syntax
Best practices in function definition
Calling functions
Defining and using function parameters