Exploring Swift Playgrounds - The Fastest and Most Effective Way to Learn to Code and to Teach Others to Use Your Code
von: Jesse Feiler
Apress, 2017
ISBN: 9781484226476
Sprache: Englisch
196 Seiten, Download: 7488 KB
Format: PDF, auch als Online-Lesen
Mehr zum Inhalt
Exploring Swift Playgrounds - The Fastest and Most Effective Way to Learn to Code and to Teach Others to Use Your Code
Contents at a Glance | 4 | ||
Contents | 5 | ||
About the Author | 9 | ||
About the Technical Reviewer | 10 | ||
Introduction | 11 | ||
Chapter 1: Introducing Swift Playgrounds | 12 | ||
Developer Overview | 12 | ||
Xcode | 13 | ||
Building the Single View Application in Xcode | 13 | ||
Exploring the Single View Application | 16 | ||
Looking into the Frameworks | 18 | ||
Swift Playgrounds | 18 | ||
Building the Classic Hello World App | 18 | ||
Building a Hello Playground | 19 | ||
Setting Fonts in Xcode | 21 | ||
Summary | 22 | ||
Chapter 2: Creating a Simple Swift Playground on Xcode | 23 | ||
Getting Started with a Playground, Code, and Results | 23 | ||
Setting Up the Playground | 24 | ||
Watching Variables and Using Code Completion | 25 | ||
Running the Playground | 30 | ||
Dealing with Errors | 30 | ||
Handling Syntax Errors | 30 | ||
Handling Contextual Errors | 32 | ||
Summary | 35 | ||
Chapter 3: Looking at Swift Basics for Playgrounds | 36 | ||
Comments and Markup | 36 | ||
Globals and Objects | 39 | ||
Classes, Enumerations, and Structures | 40 | ||
Types in Swift | 41 | ||
Properties | 42 | ||
Constants and Variables | 43 | ||
Lazy Initialization | 43 | ||
Optional Properties | 43 | ||
Summary | 48 | ||
Chapter 4: Editing Playgrounds on macOS | 49 | ||
Exploring the Two Playground Environments | 49 | ||
Creating a Playground with Xcode on macOS | 50 | ||
Turning a Static Playground into an Interactive Playground | 51 | ||
Moving a Playground from Xcode/Mac to Playgrounds/iPad | 54 | ||
Managing Interaction in a Playground | 59 | ||
Creating and Using an Editable Area | 60 | ||
Summary | 71 | ||
Chapter 5: Editing Playgrounds on iOS | 72 | ||
The Playgrounds App User Interface and Experience | 72 | ||
Using the Shortcut Bar | 76 | ||
Inserting a Simple Line of Code | 76 | ||
Inserting More Complex Syntax | 77 | ||
Choosing a Color | 81 | ||
Choosing an Image | 81 | ||
Putting the Pieces Together: Writing a Class in a Playground with the Shortcut Bar | 84 | ||
Typing the Code | 84 | ||
Using the Shortcut Bar to Write the Code | 86 | ||
Creating an Empty Playground | 86 | ||
Show the Keyboard and Handle the Red Dot | 88 | ||
Complete the Class Definition | 90 | ||
Summary | 96 | ||
Chapter 6: Entering Data and Viewing Results in Swift Playgrounds | 97 | ||
Using the Timeline | 98 | ||
Creating a Basic Playground with a View | 102 | ||
Looking at Your View in the Timeline | 103 | ||
Add a Second View to the Live View | 104 | ||
Working with Interactive Data Entry | 107 | ||
Creating a New Playground | 108 | ||
Creating a View Controller for the Live View | 108 | ||
Creating the View Controller Views | 109 | ||
Creating the Main View Subview | 110 | ||
Creating the Text Field Subview | 111 | ||
Creating the Label Subview | 112 | ||
Assembling the View Controller | 112 | ||
Managing Text Fields | 112 | ||
Updating the Text | 113 | ||
Finishing Up the View Controller | 113 | ||
Trying Out the Playground | 114 | ||
Exploring the Playground | 115 | ||
Summary | 118 | ||
Chapter 7: Adding Resources and Source Code to Playgrounds | 119 | ||
Looking Inside a Playground | 119 | ||
Exploring a Playground in the Finder (macOS) | 121 | ||
Contents.swift | 124 | ||
contents.xcplayground | 125 | ||
playground.workspace | 125 | ||
Exploring a Playground in Playgrounds (iOS) | 126 | ||
Adding Resources to a Playground | 130 | ||
Adding Code to a Playground | 137 | ||
Summary | 147 | ||
Chapter 8: Using Touch Gestures in Interactive Playgrounds | 148 | ||
Understanding Gestures Using Playgrounds | 149 | ||
Creating a Basic Gesture Playground in Xcode on macOS | 149 | ||
Creating a Playground with Live View | 149 | ||
Create a GestureView Class | 150 | ||
Creating an Instance of GestureView | 153 | ||
Adding a Gesture to GestureView | 154 | ||
Adding Another GestureView | 155 | ||
Finishing Up | 156 | ||
Creating a Basic Gesture Playground in Playgrounds on iPad | 158 | ||
Working with Gestures in a Playground | 164 | ||
Summary | 171 | ||
Chapter 9: Building a Complex Playground | 172 | ||
Collecting Your Playground Pages and Creating the MultiPlayground | 172 | ||
Assembling Playground Pages for Basic Navigation | 177 | ||
Using Basic Link Navigation | 179 | ||
Enhancing Navigation | 186 | ||
Changing Link and File Names | 186 | ||
Adding a Constant Link (Home) | 188 | ||
Using a Basic File for All Pages | 189 | ||
Making Further Enhancements | 191 | ||
Summary | 192 | ||
Index | 193 |