Muutke küpsiste eelistusi

Swift Programming: The Big Nerd Ranch Guide 3rd edition [Pehme köide]

  • Formaat: Paperback / softback, 496 pages, kõrgus x laius x paksus: 251x180x30 mm, kaal: 1026 g
  • Sari: Big Nerd Ranch Guides
  • Ilmumisaeg: 29-Dec-2020
  • Kirjastus: Big Nerd Ranch Guides
  • ISBN-10: 0135264200
  • ISBN-13: 9780135264201
  • Formaat: Paperback / softback, 496 pages, kõrgus x laius x paksus: 251x180x30 mm, kaal: 1026 g
  • Sari: Big Nerd Ranch Guides
  • Ilmumisaeg: 29-Dec-2020
  • Kirjastus: Big Nerd Ranch Guides
  • ISBN-10: 0135264200
  • ISBN-13: 9780135264201
Through the authors' carefully constructed explanations and examples, you will develop an understanding of Swift grammar and the elements of effective Swift style.
 
Throughout the book, the authors share their insights into Swift to ensure that you understand the hows and whys of Swift and can put that understanding to use in different contexts.

After working through the book, you will have the knowledge and confidence  to develop your own solutions to a wide range of programming challenges using Swift.
Introduction xv
Learning Swift xv
Why Swift? xv
What About Objective-C? xvi
Prerequisites xvi
How This Book Is Organized xvi
How to Use This Book xvii
Challenges and For the More Curious xviii
Typographical Conventions xviii
Necessary Hardware and Software xviii
Before You Begin xviii
I Getting Started
1(18)
1 Getting Started
3(10)
Getting Started with Xcode
4(2)
Playing in a Playground
6(1)
Running Your Code
7(1)
Troubleshooting Playgrounds
8(1)
Varying Variables and Printing to the Console
8(3)
Adding Comments
11(1)
You Are on Your Way!
11(1)
Bronze Challenge
12(1)
2 Types, Constants, and Variables
13(6)
Types
13(2)
Constants vs Variables
15(1)
String Interpolation
16(1)
Bronze Challenge
17(2)
II The Basics
19(60)
3 Conditionals
21(6)
If/else
21(3)
Ternary Operator
24(1)
Nested ifs
25(1)
Else If
26(1)
Bronze Challenge
26(1)
4 Numbers
27(14)
Integers
27(2)
Creating Integer Instances
29(2)
Operations on Integers
31(4)
Integer division
32(1)
Operator shorthand
33(1)
Overflow operators
33(2)
Converting Between Integer Types
35(1)
Floating-Point Numbers
36(2)
Ranges of Numbers
38(1)
Bronze Challenge
39(1)
For the More Curious: Numeric Literals
39(2)
5 Switch
41(12)
Switch Syntax
42(6)
Ranges
44(1)
Value binding
45(2)
Where Clauses
47(1)
Tuples and Pattern Matching
48(2)
Switch Vs If/Else
50(2)
Bronze Challenge
52(1)
Silver Challenge
52(1)
6 Loops
53(12)
for-in Loops
54(5)
where
57(2)
While Loops
59(1)
repeat-while Loops
60(1)
Control Transfer Statements in Loops
61(3)
Silver Challenge
64(1)
7 Strings
65(14)
Working with Strings
65(3)
Characters
67(1)
Unicode
68(6)
Unicode scalars
68(2)
Canonical equivalence
70(4)
Bronze Challenge
74(1)
Silver Challenge
74(1)
For the More Curious: Substrings
74(3)
For the More Curious: Multiline Strings
77(2)
III Collections and Functions
79(78)
8 Arrays
81(12)
Creating an Array
82(2)
Accessing and Modifying Arrays
84(3)
Combining Arrays
87(1)
Array Equality
88(1)
Immutable Arrays
89(1)
Documentation
89(3)
Bronze Challenge
92(1)
Silver Challenge
92(1)
9 Optionals
93(12)
Optional Types
94(2)
Optional Binding
96(3)
Implicitly Unwrapped Optionals
99(1)
Optional Chaining
100(1)
Modifying an Optional in Place
101(1)
The Nil Coalescing Operator
102(1)
Bronze Challenge
103(1)
Silver Challenge
103(1)
Gold Challenge
103(2)
10 Dictionaries
105(8)
Creating a Dictionary
106(1)
Accessing and Modifying Values
107(2)
Adding and Removing Values
109(1)
Looping over a Dictionary
110(1)
Immutable Dictionaries
111(1)
Translating a Dictionary to an Array
111(1)
Silver Challenge
112(1)
Gold Challenge
112(1)
11 Sets
113(10)
What Is a Set?
113(1)
Getting a Set
114(1)
Working with Sets
115(4)
Unions
116(1)
Intersections
117(1)
Disjoint
118(1)
Moving Between Types
119(2)
Bronze Challenge
121(1)
Silver Challenge
121(2)
12 Functions
123(16)
A Basic Function
124(1)
Function Parameters
125(5)
Parameter names
126(1)
Default parameter values
127(2)
In-out parameters
129(1)
Returning from a Function
130(1)
Nested Function Definitions and Scope
131(1)
Multiple Returns
132(1)
Optional Return Types
133(1)
Exiting Early from a Function
134(1)
Function Types
135(1)
Bronze Challenge
136(1)
Silver Challenge
136(1)
For the More Curious: Void
137(1)
For the More Curious: Variadic Parameters
138(1)
13 Closures
139(18)
Closure Syntax
139(2)
Closure Expression Syntax
141(3)
Functions as Arguments
144(2)
Closures Capture Their Enclosing Scope
146(4)
Functional Programming
150(1)
Higher-Order Functions
150(4)
map(:)
151(1)
filter(:)
152(1)
reduce(::)
153(1)
Bronze Challenge
154(1)
Silver Challenge
154(1)
Gold Challenge
154(1)
For the More Curious: Functions as Return Types
155(2)
IV Enumerations, Structures, and Classes
157(104)
14 Enumerations
159(16)
Basic Enumerations
159(4)
Enumerations with Raw Values
163(1)
Methods
165(4)
Associated Values
169(3)
Bronze Challenge
172(1)
Silver Challenge
172(1)
For the More Curious: Recursive Enumerations
172(3)
15 Structs and Classes
175(24)
A New Project
175(6)
Structures
181(3)
Instance Methods
184(2)
Mutating methods
185(1)
Classes
186(8)
A Monster class
186(1)
Inheritance
187(7)
Looking Ahead: What Is the Real Difference?
194(3)
Bronze Challenge
197(1)
Silver Challenge
197(1)
For the More Curious: Type Methods
197(2)
16 Properties
199(18)
Basic Stored Properties
200(1)
Nested Types
201(1)
Lazy Stored Properties
201(3)
Computed Properties
204(2)
A getter and a setter
205(1)
Property Observers
206(2)
Type Properties
208(3)
Access Control
211(4)
Controlling getter and setter visibility
213(2)
Bronze Challenge
215(1)
Silver Challenge
215(1)
Gold Challenge
215(1)
For the More Curious: Key Paths
216(1)
17 Initialization
217(22)
Initializer Syntax
217(1)
Struct Initialization
218(5)
Default initializers for structs
218(1)
Custom initializers for structs
219(4)
Class Initialization
223(9)
Default initializers for classes
223(1)
Initialization and class inheritance
224(6)
Required initializers for classes
230(1)
Deinitialization
231(1)
Failable Initializers
232(3)
A failable Town initializer
233(2)
Initialization Going Forward
235(1)
Silver Challenge
236(1)
Gold Challenge
236(1)
For the More Curious: Initializer Parameters
237(2)
18 Value vs Reference Types
239(22)
Value Semantics
239(3)
Reference Semantics
242(2)
Constant Value and Reference Types
244(2)
Using Value and Reference Types Together
246(1)
Copying
247(2)
Equality vs Identity
249(2)
What Should I Use?
251(1)
For the More Curious: Copy on Write
252(9)
V Advanced Swift
261(134)
19 Protocols
263(18)
Formatting a Table of Data
264(4)
Protocols
268(3)
Protocol Conformance
271(2)
Protocol Inheritance
273(1)
Protocols as Types
274(2)
Protocol Composition
276(2)
Mutating Methods
278(2)
Bronze Challenge
280(1)
Silver Challenge
280(1)
Electrum Challenge
280(1)
Gold Challenge
280(1)
20 Extensions
281(8)
Extending an Existing Type
282(1)
Extending Your Own Type
283(5)
Using extensions to add protocol conformance
284(1)
Adding an initializer with an extension
285(1)
Nested types and extensions
286(1)
Extensions with methods
287(1)
Bronze Challenge
288(1)
Silver Challenge
288(1)
21 Generics
289(22)
Generic Data Structures
290(2)
Generic Functions and Methods
292(3)
Type Constraints
295(2)
Associated Types
297(3)
Type Constraints in where Clauses
300(3)
Generic Composition and Opaque Types
303(5)
Bronze Challenge
308(1)
Silver Challenge
308(1)
Gold Challenge
308(1)
For the More Curious: Understanding Optionals
309(2)
22 Protocol Extensions
311(14)
Modeling Exercise
312(1)
Extending Exercise
313(2)
Self Types and Type Values
315(1)
Protocol Extension where Clauses
316(2)
Default Implementations with Protocol Extensions
318(2)
Implementation Conflicts
320(2)
Bronze Challenge
322(1)
Silver Challenge
322(1)
Gold Challenge
322(1)
For the More Curious: Polymorphism and Protocol-Oriented Programming
323(2)
23 Error Handling
325(24)
Classes of Errors
325(1)
Lexing an Input String
326(10)
Catching Errors
336(1)
Parsing the Token Array
337(5)
Handling Errors by Sticking Your Head in the Sand
342(2)
Swift Error-Handling Philosophy
344(2)
Bronze Challenge
346(1)
Silver Challenge
346(1)
Gold Challenge
346(1)
For the More Curious: Storing Failable Results for Later
347(2)
24 Memory Management and ARC
349(20)
Memory Allocation
349(1)
Strong Reference Cycles
350(8)
Breaking Strong Reference Cycles with weak
358(1)
Reference Cycles with Closures
359(5)
Escaping and Non-Escaping Closures
364(2)
Tin Challenge
366(1)
Bronze Challenge
366(1)
Gold Challenge
366(1)
For the More Curious: A Bit of History
367(1)
For the More Curious: Do I Have the Only Reference?
368(1)
25 Equatable, Comparable, and Hashable
369(16)
Equatable
369(4)
Infix operators
372(1)
Buy one method, get another free!
372(1)
Comparable
373(3)
Protocol inheritance
375(1)
Hashable
376(3)
Custom hashing
377(2)
Bronze Challenge
379(1)
Silver Challenge
379(1)
Gold Challenge
380(1)
Platinum Challenge
380(1)
For the More Curious: Custom Operators
381(4)
26 Property Wrappers
385(10)
Defining a Property Wrapper
386(5)
Additional configuration
389(2)
Accessing the Wrapper Itself
391(1)
Projecting Related Values
392(2)
Bronze Challenge
394(1)
Silver Challenge
394(1)
Gold Challenge
394(1)
VI Writing Applications
395(66)
27 Command-Line Utilities
397(26)
Introduction to the Command Line
397(3)
Building the Word Finder
400(6)
Loading the words from disk
405(1)
Retrieving Command-Line Arguments
406(3)
Receiving Input Interactively
409(3)
Running Your App from the Command Line
412(1)
Parsing Command-Line Arguments with ArgumentParser
413(8)
Adding ArgumentParser to your project
413(4)
Declaring arguments for ArgumentParser to parse
417(4)
Silver Challenge
421(1)
Gold Challenge
421(2)
28 iOS and macOS Apps
423(36)
Getting Started with TahDoodle
424(3)
That is some View
427(4)
Displaying Dynamic Data
431(7)
Accepting User Input
438(9)
Sharing references to value-type data
441(5)
Interlude: Troubleshooting with property observers
446(1)
Observing Changes to the Store
447(2)
Saving and Loading User Data
449(5)
Supporting macOS
454(3)
Bronze Challenge
457(1)
Silver Challenge
457(1)
Gold Challenge
457(2)
29 Conclusion
459(2)
Where to Go from Here?
459(1)
Shameless Plugs
459(1)
An Invitation to the Community
460(1)
Index 461
Mikey Ward has been an instructor and software engineer at Big Nerd Ranch for over ten years. He has taught courses around the world on iOS and macOS development using Objective-C and Swift. He currently maintains the company's popular Swift Essentials course the foundation for this book as well as the Advanced iOS course. When Mikey is not teaching or writing, he can be found running a tabletop game or just out for a run.