SitePoint
  • Premium
  • Library
  • Community
  • Jobs
  • Blog
LoginStart Free Trial
Swift Cookbook
Swift Cookbook
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Sections
Getting ready
How to do it…
How it works…
There’s more…
See also
Get in touch
Reviews
Share Your Thoughts
Download a free PDF copy of this book
Technical requirements
Writing your first code in Swift
Getting ready
How to do it…
There’s more…
See also
Using the basic types – strings, ints, floats, and booleans
Getting ready
How to do it…
How it works…
There’s more…
See also
Reusing code in functions
Getting ready
How to do it…
There’s more…
See also
Encapsulating functionality in object classes
Getting ready
How to do it…
How it works…
There’s more…
See also
Bundling values into structs
Getting ready
How to do it…
How it works…
There’s more…
See also
Enumerating values with enums
Getting ready
How to do it…
How it works…
There’s more…
See also
Passing around functionality with closures
Getting ready
How to do it…
How it works…
There’s more…
See also
Using protocols to define interfaces
Getting ready
How to do it…
How it works…
There’s more…
See also
Technical requirements
Bundling variables into tuples
Getting ready
How to do it...
How it works...
There’s more...
See also
Ordering your data with arrays
Getting ready
How to do it...
How it works...
There’s more...
See also
Containing your data in sets
Getting ready
How to do it...
How it works...
See also
Storing key-value pairs with dictionaries
Getting ready
How to do it...
How it works...
There’s more...
See also
Subscripts for custom types
Getting ready
How to do it...
How it works...
There’s more...
See also
Changing your name with a type alias
Getting ready
How to do it...
There’s more...
See also
Getting property changing notifications using property observers
Getting ready
How to do it...
How it works...
There’s more...
See also
Extending functionality with extensions
Getting ready
How to do it...
How it works...
There’s more...
See also
Controlling access with access control
Getting ready
How to do it...
How it works...
There’s more...
See also
Technical requirements
Making decisions with if/else
Getting ready
How to do it...
How it works...
There’s more...
See also
Handling all cases with switch
Getting ready
How to do it...
How it works...
See also
Looping with for loops
Getting ready
How to do it...
How it works...
See also
Looping with while loops
Getting ready
How to do it...
How it works...
There’s more...
See also
Handling errors with try, throw, do, and catch
Getting ready
How to do it...
How it works...
There’s more...
See also
Checking upfront with guard
Getting ready
How to do it...
How it works...
There’s more...
See also
Doing it later with defer
Getting ready
How to do it...
How it works...
There’s more...
See also
Bailing out with fatalError and precondition
Getting ready
How to do it...
How it works...
See also
Technical requirements
Using generics with types
Getting ready
How to do it...
How it works...
There’s more...
See also
Using generics with functions
Getting ready
How to do it...
How it works...
There’s more...
See also
Using generics with protocols
Getting ready
How to do it...
How it works...
There’s more...
See also
Using advanced operators
Getting ready
How to do it...
See also
Defining option sets
Getting ready
How to do it...
How it works...
See also
Creating custom operators
Getting ready
How to do it...
How it works...
There’s more...
See also
Nesting types and namespacing
Getting ready
How to do it...
How it works...
There’s more...
See also
Technical requirements
Comparing dates with Foundation
Getting ready
How to do it…
How it works…
See also
Fetching data with URLSession
Getting ready
How to do it…
How it works…
See also
Working with JSON
Getting ready
How to do it...
There’s more...
Working with XML
Getting ready
How to do it...
How it works...
There’s more...
See also
Technical requirements
Getting ready
How to do it...
How it works...
See also
Leveraging DispatchGroups
Getting ready
How to do it...
How it works...
See also
Implementing the operation class
Getting ready
How to do it...
How it works...
See also
Async/Await in Swift
Getting ready
How to do it...
How it works...
See also
Technical requirements
Building an iOS app using UIKit and storyboards
Getting ready
How to do it...
How it works...
There’s more...
See also
Unit and integration testing with XCTest
Getting ready
How to do it...
How it works...
There’s more...
See also
UI testing with XCUITest
Getting ready
How to do it...
There’s more...
See also
Technical requirements
Declarative syntax
Getting ready
How to do it…
How it works...
There’s more...
See also
Function builders, property wrappers, and opaque return types
Getting ready
How to do it…
There’s more...
See also
Building simple views in SwiftUI
Getting ready
How to do it...
How it works...
There’s more...
See also
Combine and data flow in SwiftUI
Getting ready
How to do it...
How it works...
See also
Technical requirements
Using Reactive Streams
Getting ready
How to do it...
How it works...
See also
Understanding Observable Objects
How to do it...
How it works...
See also
Understanding publishers and subscribers
How to do it...
How it works...
See also
Combine versus Delegate pattern
How to do it...
How it works...
Technical requirements
Getting ready
How to do it...
How it works...
There’s more...
See also
Using CoreML models to detect objects in images
Getting ready
How to do it...
How it works...
There’s more...
See also
Building a video capture app
Getting ready
How to do it...
How it works...
There’s more...
See also
Using CoreML and the Vision framework to detect objects in real time
Getting ready
How to do it...
How it works...
See also
Technical requirements
Surface detection with ARKit
Getting ready
How to do it...
How it works...
There’s more…
See also
Using 3D models with ARKit
Getting ready
How to do it…
How it works...
There’s more…
Using Reality Composer Pro for visionOS
Getting ready
How to do it...
How it works...
There’s more…
See also
Technical requirements
Building a chart with data
Getting ready
How to do it…
How it works...
See also
Displaying multiple datasets
How to do it...
How it works...
Exploring chart marks and modifiers
How to do it...
How it works...
There’s more...
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Share Your Thoughts
Download a free PDF copy of this book

Community Questions