The Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified
Book created for educational purposes and is not affiliated with group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners
https://goalkicker.com/
Content
1-1
Content list
1-2
About
1-3
Chapter 1: Getting started with Swift Language
1-4
Section 1.1: Your first Swift program
1-5
Section 1.2: Your first program in Swift on a Mac (using a Playground)
1-6
Section 1.3: Your first program in Swift Playgrounds app on iPad
1-7
Section 1.4: Installing Swift
1-8
Section 1.5: Optional Value and Optional enum
1-9
Chapter 2: Variables & Properties
1-10
Section 2.1: Creating a Variable
1-11
Section 2.2: Property Observers
1-12
Section 2.3: Lazy Stored Properties
1-13
Section 2.4: Property Basics
1-14
Section 2.5: Computed Properties
1-15
Section 2.6: Local and Global Variables
1-16
Section 2.7: Type Properties
1-17
Chapter 3: Numbers
1-18
Section 3.1: Number types and literals
1-19
Section 3.2: Convert numbers to/from strings
1-20
Section 3.3: Rounding
1-21
Section 3.4: Random number generation
1-22
Section 3.5: Convert one numeric type to another
1-23
Section 3.6: Exponentiation
1-24
Chapter 4: Strings and Characters
1-25
Section 4.1: String & Character Literals
1-26
Section 4.2: Concatenate strings
1-27
Section 4.3: String Encoding and Decomposition
1-28
Section 4.4: Examine and compare strings
1-29
Section 4.5: Reversing Strings
1-30
Section 4.6: Check if String contains Characters from a Defined Set
1-31
Section 4.7: String Iteration
1-32
Section 4.8: Splitting a String into an Array
1-33
Section 4.9: Unicode
1-34
Section 4.10: Converting Swift string to a number type
1-35
Section 4.11: Convert String to and from Data / NSData
1-36
Section 4.12: Formatting Strings
1-37
Section 4.13: Uppercase and Lowercase Strings
1-38
Section 4.14: Remove characters from a string not defined in Set
1-39
Section 4.15: Count occurrences of a Character into a String
1-40
Section 4.16: Remove leading and trailing WhiteSpace and NewLine
1-41
Chapter 5: Booleans
1-42
Section 5.1: What is Bool?
1-43
Section 5.2: Booleans and Inline Conditionals
1-44
Section 5.3: Boolean Logical Operators
1-45
Section 5.4: Negate a Bool with the prefix ! operator
1-46
Chapter 6: Arrays
1-47
Section 6.1: Basics of Arrays
1-48
Section 6.2: Extracting values of a given type from an Array with flatMap(_:)
1-49
Section 6.3: Combining an Array's elements with reduce(_:combine:)
1-50
Section 6.4: Flattening the result of an Array transformation with flatMap(_:)
1-51
Section 6.5: Lazily flattening a multidimensional Array with flatten()
1-52
Section 6.6: Filtering out nil from an Array transformation with flatMap(_:)
1-53
Section 6.7: Subscripting an Array with a Range
1-54
Section 6.8: Removing element from an array without knowing it's index
1-55
Section 6.9: Sorting an Array of Strings
1-56
Section 6.10: Accessing indices safely
1-57
Section 6.11: Filtering an Array
1-58
Section 6.12: Transforming the elements of an Array with map(_:)
1-59
Section 6.13: Useful Methods
1-60
Section 6.14: Sorting an Array
1-61
Section 6.15: Finding the minimum or maximum element of an Array
1-62
Section 6.16: Modifying values in an array
1-63
Section 6.17: Comparing 2 Arrays with zip
1-64
Section 6.18: Grouping Array values
1-65
Section 6.19: Value Semantics
1-66
Section 6.20: Accessing Array Values
1-67
Chapter 7: Tuples
1-68
Section 7.1: What are Tuples?
1-69
Section 7.2: Decomposing into individual variables
1-70
Section 7.3: Tuples as the Return Value of Functions
1-71
Section 7.4: Using a typealias to name your tuple type
1-72
Section 7.5: Swapping values
1-73
Section 7.6: Tuples as Case in Switch
1-74
Chapter 8: Enums
1-75
Section 8.1: Basic enumerations
1-76
Section 8.2: Enums with associated values
1-77
Section 8.3: Indirect payloads
1-78
Section 8.4: Raw and Hash values
1-79
Section 8.5: Initializers
1-80
Section 8.6: Enumerations share many features with classes and structures
1-81
Section 8.7: Nested Enumerations
1-82
Chapter 9: Structs
1-83
Section 9.1: Structs are value types
1-84
Section 9.2: Accessing members of struct
1-85
Section 9.3: Basics of Structs
1-86
Section 9.4: Mutating a Struct
1-87
Section 9.5: Structs cannot inherit
1-88
Chapter 10: Sets
1-89
Section 10.1: Declaring Sets
1-90
Section 10.2: Performing operations on sets
1-91
Section 10.3: CountedSet
1-92
Section 10.4: Modifying values in a set
1-93
Section 10.5: Checking whether a set contains a value
1-94
Section 10.6: Adding values of my own type to a Set
1-95
Chapter 11: Dictionaries
1-96
Section 11.1: Declaring Dictionaries
1-97
Section 11.2: Accessing Values
1-98
Section 11.3: Change Value of Dictionary using Key
1-99
Section 11.4: Get all keys in Dictionary
1-100
Section 11.5: Modifying Dictionaries
1-101
Section 11.6: Merge two dictionaries
1-102
Chapter 12: Switch
1-103
Section 12.1: Switch and Optionals
1-104
Section 12.2: Basic Use
1-105
Section 12.3: Matching a Range
1-106
Section 12.4: Partial matching
1-107
Section 12.5: Using the where statement in a switch
1-108
Section 12.6: Matching Multiple Values
1-109
Section 12.7: Switch and Enums
1-110
Section 12.8: Switches and tuples
1-111
Section 12.9: Satisfy one of multiple constraints using switch
1-112
Section 12.10: Matching based on class - great for prepareForSegue
1-113
Section 12.11: Switch fallthroughs
1-114
Chapter 13: Optionals
1-115
Section 13.1: Types of Optionals
1-116
Section 13.2: Unwrapping an Optional
1-117
Section 13.3: Nil Coalescing Operator
1-118
Section 13.4: Optional Chaining
1-119
Section 13.5: Overview - Why Optionals?
1-120
Chapter 14: Conditionals
1-121
Section 14.1: Optional binding and "where" clauses
1-122
Section 14.2: Using Guard
1-123
Section 14.3: Basic conditionals: if-statements
1-124
Section 14.4: Ternary operator
1-125
Section 14.5: Nil-Coalescing Operator
1-126
Chapter 15: Error Handling
1-127
Section 15.1: Error handling basics
1-128
Section 15.2: Catching dierent error types
1-129
Section 15.3: Catch and Switch Pattern for Explicit Error Handling
1-130
Section 15.4: Disabling Error Propagation
1-131
Section 15.5: Create custom Error with localized description
1-132
Chapter 16: Loops
1-133
Section 16.1: For-in loop
1-134
Section 16.2: Repeat-while loop
1-135
Section 16.3: For-in loop with filtering
1-136
Section 16.4: Sequence Type forEach block
1-137
Section 16.5: while loop
1-138
Section 16.6: Breaking a loop
1-139
Chapter 17: Protocols
1-140
Section 17.1: Protocol Basics
1-141
Section 17.2: Delegate pattern
1-142
Section 17.3: Associated type requirements
1-143
Section 17.4: Class-Only Protocols
1-144
Section 17.5: Protocol extension for a specific conforming class
1-145
Section 17.6: Using the RawRepresentable protocol (Extensible Enum)
1-146
Section 17.7: Implementing Hashable protocol
1-147
Chapter 18: Functions
1-148
Section 18.1: Basic Use
1-149
Section 18.2: Functions with Parameters
1-150
Section 18.3: Subscripts
1-151
Section 18.4: Methods
1-152
Section 18.5: Variadic Parameters
1-153
Section 18.6: Operators are Functions
1-154
Section 18.7: Passing and returning functions
1-155
Section 18.8: Function types
1-156
Section 18.9: Inout Parameters
1-157
Section 18.10: Throwing Errors
1-158
Section 18.11: Returning Values
1-159
Section 18.12: Trailing Closure Syntax
1-160
Section 18.13: Functions With Closures
1-161
Chapter 19: Extensions
1-162
Section 19.1: What are Extensions?
1-163
Section 19.2: Variables and functions
1-164
Section 19.3: Initializers in Extensions
1-165
Section 19.4: Subscripts
1-166
Section 19.5: Protocol extensions
1-167
Section 19.6: Restrictions
1-168
Section 19.7: What are extensions and when to use them
1-169
Chapter 20: Classes
1-170
Section 20.1: Defining a Class
1-171
Section 20.2: Properties and Methods
1-172
Section 20.3: Reference Semantics
1-173
Section 20.4: Classes and Multiple Inheritance
1-174
Section 20.5: deinit
1-175
Chapter 21: Type Casting
1-176
Section 21.1: Downcasting
1-177
Section 21.2: Type casting in Swift Language
1-178
Section 21.3: Upcasting
1-179
Section 21.4: Example of using a downcast on a function parameter involving subclassing