Have a unique app idea but worried you don’t quite have the coding skills to build it? Good news: You can stop fretting about someone beating you to market with the same idea and start work right now using SwiftUI. SwiftUI is a gateway app development framework that has become one of the best ways for fledgling developers to get iOS apps off the ground without having to become a coding expert overnight.
SwiftUI For Dummies makes that process even faster, providing a friendly introduction to the SwiftUI and Swift programming language and helping you feel right at home creating and building with playgrounds. The book also covers the frameworks and APIs that make it so easy to create smooth, intuitive interfaces―just dive right in and have fun!
• Combine projects into workspaces
• Employ Xcode editing tools
• Use constants and variables
• Test your code on iOS Simulator
Time is of the essence, and with SwiftUI For Dummies, it’s also on your side. Get going with this friendly guide today, and you’ll be celebrating the successful launch of your app way before you thought possible!
Author(s): Wei-Meng Lee
Series: For Dummies
Edition: 1
Publisher: John Wiley & Sons
Year: 2020
Language: English
Commentary: Vector PDF
Pages: 416
City: Hoboken, NJ
Tags: Apple; macOS; GUI; iOS; Mobile Development; Swift; Best Practices; Animation; Application Development; User Interface; Mobile Applications; iPadOS; watchOS; tvOS
Title Page
Copyright Page
Table of Contents
Introduction
About This Book
Foolish Assumptions
Icons Used in This Book
Beyond the Book
Where to Go from Here
Part 1 Getting Started with Swift and SwiftUI
Chapter 1 Introducing SwiftUI
Understanding What SwiftUI Is
Getting the Tools
Hello, SwiftUI
Automatically previewing your user interface using the canvas
Working with Live Preview
Generating different previews
The Gory Details
Info.plist
AppDelegate.swift
SceneDelegate.swift
Chapter 2 Basics of the Swift Programming Language
Basic Swift Syntax
Constants
Variables
Strings
Comments
Basic Data Types
Integers
Floating-point numbers
Booleans
Tuples
Arrays
Retrieving elements from an array
Inserting elements into an array
Modifying elements in an array
Appending elements to an array
Removing elements from an array
Dictionaries
Retrieving elements from a dictionary
Modifying an item in a dictionary
Removing an item from a dictionary
Optional Types
Working with implicitly unwrapped optionals
Using optional binding
Unwrapping optionals using “?”
Using the nil coalescing operator
Functions
Understanding input parameters
Returning a value
Flow Control
If-Else statement
Ternary conditional operator
Switch statement
Looping
For-In loop
While loop
Repeat-While loop
Control transfer statements
Range operators
Structures
Memberwise initializers
Structures as value types
Classes
Defining a class
Understanding properties
Using methods in classes
Trying out the self property
Closures
Understanding closures
Using functions as closures
Assigning closures to variables
Writing closures inline
Understanding type inference
Using shorthand argument names
Working with the operator function
Using trailing closures
Protocols
Defining and using a protocol
Conforming to a protocol
Using the Codable protocol
Using the some keyword
Part 2 Understanding the Basics of SwiftUI
Chapter 3 Getting Started with the Basics of SwiftUI
Taking a Look at SwiftUI Views
Conforming to the View protocol
Using modifiers
Stacking modifiers
Using the Inspector
Displaying an Image
Using modifiers on the Image view
Resizing images
Displaying a Button
Customizing the button
Adding actions
Stacking the Views
VStack
HStack
Putting on the Finishing Touches
Chapter 4 Handling User Inputs and Custom Views
Looking at Input Views
TextField
SecureField
Toggle
Slider
Stepper
Picker
Composing Custom Views
Composing the custom view
Using the custom view
Chapter 5 Displaying Lists of Items
Using the List View to Display Items
Customizing the rows
Adding rows programmatically
Alternative way to generate rows in a List view
Displaying the List within a NavigationView
Making the items tappable
Adding rows
Using the Identifiable protocol
Deleting rows
Editing rows
Moving rows
Displaying Sections
Displaying sections from a dictionary
Changing the style of the List view
Previewing in Light and Dark Modes
During runtime
During design time
Chapter 6 Creating Navigation and Tabbed Applications
Creating Navigation Apps
Working with the two key views in navigation-style apps
Navigating to a page
Navigating programmatically
Creating a news reader application
Creating Tabbed Applications
Using the TabView
Selecting TabViews programmatically
Chapter 7 Formatting Your User Interface
Laying Out Views Using Stacks
VStack
HStack
ZStack
Using Container Views
Form and Section
Group
Divider
Part 3 Exploring with SwiftUI in More Detail
Chapter 8 Understanding State Management in SwiftUI
Using a Property Wrapper
Maintaining State Using State Variables
Binding State Variables
Managing State from External Objects
Using the ObservableObject protocol and @Published
Using the @ObservedObject
Sharing Objects
Accessing Built-in Environment Variables
Defining your own environment keys
Using your own environment keys
Chapter 9 Using Legacy UIKit Views and View Controllers in SwiftUI
Using UIKit in SwiftUI
Understanding the UIKit View Controller life cycle
Understanding the SwiftUI view life cycle
Using the UIViewRepresentable Protocol for UIKit Views
ActivityIndicator
WebView
Using the UIViewControllerRepresentable Protocol for UIKit View Controllers
Creating the ImagePickerViewController
Handling events using coordinators
Defining the methods in the Coordinator class
Using the updated ImagePickerViewController
Part 4 Performing Animations and Drawings
Chapter 10 Drawings and Special Effects
Drawing Using the Five Built-in Shapes
Rectangles
Rounded rectangles
Circles
Capsules
Ellipses
Clipping with the Basic Shapes
Drawing Custom Shapes
Drawing lines
Filling the shape
Drawing a border
Drawing an arc
Combining fill and stroke
Using Special Effects in SwiftUI
Blend modes
Blurs
Saturation
Chapter 11 Performing Animations in SwiftUI
Understanding How to Animate
Specifying the type of animation
Repeating the animation
Stopping the animation
Performing Your Own Animation
Rotating in 2D
Rotating in 3D
Creating a Custom Progress Indicator
Indeterminate progress indicator
Determinate progress indicator
Chapter 12 Creating a Complete Project
Understanding What the App Does
Building the Project
Creating the layouts
Defining the news sources and observable objects
Fetching the data
Displaying the news headlines
Displaying the images
Displaying the news
Creating the share sheet
Creating the preferences view
Persisting the user’s preferences
Deploying the App
Part 5 The Part of Tens
Chapter 13 Ten SwiftUI Tips and Tricks
Resuming Live Preview
Implementing Localization
Combining Text Views
Creating Custom Modifiers
Displaying Multiple Alerts
Enabling Debug Preview
Previewing Using Different Devices
Dark Mode Only Works On NavigationView
Extracting Subviews
Displaying a Context Menu
Chapter 14 Ten Great SwiftUI Resources
Apple
SwiftUI by Example
100 Days of SwiftUI
Gosh Darn SwiftUI
SwiftUI Hub
Awesome SwiftUI
raywenderlich.com
Swift Talk
About SwiftUI
Stack Overflow
Appendix: Code Snippets for Common SwiftUI Views
Index
EULA