Learning Swift: Building Apps for macOS, iOS, and Beyond

Learning Swift: Building Apps for macOS, iOS, and Beyond


View All Available Formats & Editions
Choose Expedited Shipping at checkout for guaranteed delivery by Tuesday, April 30

Product Details

ISBN-13: 9781491987575
Publisher: O'Reilly Media, Incorporated
Publication date: 04/21/2018
Pages: 378
Sales rank: 418,434
Product dimensions: 6.90(w) x 9.10(h) x 0.90(d)

About the Author

Jon Manning is a world renown iOS development trainer and writer, game designer and mobile software engineering wizard.

He has co-authored two books on mobile development and enjoys re-implementing such things as OpenGL and the Objective-C runtime (in his spare time).Jon is also a researcher in Human-Computer Interaction working towards a PhD.

Paris Buttfield-Addison is a producer and co-founder at Secret Lab, a mobile development studio based in beautiful Hobart, Australia. Secret Lab builds games for mobile devices, and primarily for children, such as the AIMIA winning (2014) ABC Play School apps for iPad.

Paris formerly worked with Meebo (which was acquired by Google) as mobile product manager. He has a BA in History, and a PhD in Computing/HCI, and has written nearly a dozen technical, game design, and mobile development books, mostly for O’Reilly Media.

Paris can be found on Twitter @parisba. He still thinks digital watches are a pretty neat idea.

For more info visit Secret Lab or paris.id.au.

Tim Nugent pretends to be a mobile app developer, game designer, PhD student, and now he even pretends to be an author. When he isn't busy avoiding being found out as a fraud, he spends most of his time designing and creating little apps and games he won't let anyone see. Tim spent a disproportionately long time writing this tiny little bio, most of which was spent trying to stick a witty sci-fi reference in, before he simply gave up. Tim can be found as @The_McJones on Twitter.

Table of Contents

Preface ix

Part I Welcome to Swift

1 Getting Started 3

Xcode 3

Getting Xcode 4

Creating Your First Project 4

Working with the Xcode Interface 6

The Editor 6

The Toolbar 8

The Navigator 10

Utilities 11

The Debug Area 13

Running Your Code 13

The iOS Simulator 14

Running on a Device 15

Distributing Your Apps 16

The Interface Builder 16

Interfaces in iOS 18

Conclusion 19

2 The Swift Programming Language 21

The Swift Language 22

Swift 3 Versus 4 24

Playgrounds and Swift 24

Comments 26

Imports 27

Variables 28

Operators 30

Collections 31

Arrays 31

Tuples 32

Dictionaries 33

Control Flow 34

Loops 35

Switches 37

Types 39

Working with Strings 40

Sets 42

Enumerations 44

Type Safety and Conversion 46

Optionals 48

Type Casting 52

Functions and Closures 53

Using Functions as Variables 56

Closures 58

Convenience Features 59

The defer Keyword 59

The guard Keyword 60

Making Your Code Swifty 61

Conclusion 61

3 Object-Oriented Development in Swift 63

Classes and Objects 63

Initialization and Deinitialization 64

Properties 66

Inheritance 69

Protocols 70

Extensions 72

Access Control 75

Operator Overloading and Custom Operators 78

Subscripts 80

Generics 81

Structures 82

Error Handling 84

Memory Management 87

Design Patterns in Swift 91

Model-View-Controller 92

Delegation 93

Swift Libraries 96

Structuring an App 97

Swift Package Manager 101

Conclusion 107

Part II Building Selfiegram

4 Setting Up Our App 111

Designing Selfiegram 112

Creating the Project 115

The Structure 118

Renaming the Views 120

5 Building the Model Object 123

The Selfie Object 123

The SelfieStore 127

Testing the SelfieStore 130

Filling Out the Method Stubs 136

6 Building the Selfie List UI 145

Creating the Selfie List 145

Improving the Selfie List 151

7 Adding and Deleting Selves 155

Deleting Selfies 155

Taking New Selfies 157

8 Viewing and Editing Selfies 165

The Selfie Viewer 165

Connecting the Code and the UI 167

Editing a Selfie 172

9 Adding Location Info to the Selfies 175

Updating the Model 175

Testing Our New Model 178

Showing a Selfies Location 179

Expanding the Map 183

Determining Locations 186

Configuring the App to Support Location 186

Talking to the Location Hardware 188

10 Building a Settings View 193

Building the Settings UI 193

Connecting the Settings into Our Hierarchy 195

Hooking Up the Settings 196

Implementing the Settings 197

11 Reminders and Notifications 201

Adding a Reminder to the Settings 201

Creating a Notification 203

Part III Polishing Sehiegram

12 Theming and Sharing Selfiegram 213

Custom Fonts 214

Making the Theme 217

Sharing Selfies 222

Sharing from the Detail View Controller 223

Sharing from the List View Controller 224

13 Custom Views and View Controllers 227

A Camera View 228

The Camera View Controller 231

Building the UI 231

Connecting the UI 234

Talking to the Camera 234

Calling the Capture View Controller 240

14 Image Overlays 245

Creating the Overlay Model 245

Testing the Overlay Manager 252

Writing the Tests 252

Returning Available Overlays 255

Downloading Overlay Information 256

Downloading Overlay Images 258

15 Overlay UI 263

Building the UI 263

Hooking Up the UI 266

Creating the Overlay View 266

Presenting the Overlays 268

Initial Setup 268

Drawing Eyebrows 271

Vision and Image Detection 274

Connecting It into the App 279

16 Localization and Internationalization 283

Internationalization 284

Generating the String Table 286

Localization 287

Translating the Strings 290

Testing Locales 290

Pseudolanguages 292

Previewing Localizations 294

Conclusion 296

Part IV Beyond Developing Selfiegram

17 Debugging 299

The Debugger 299

Breakpoints 300

Inspecting Code 304

Controlling Program Flow 307

Performance 309

Instruments 310

18 UI Tests 313

UI Testing Classes 313

Writing UI Tests 314

A Basic Test 314

Recording UI Actions 315

Checking if Elements Exist 318

Handling UI Interruptions 319

19 Automating Chores with Fastlane 321

The Fastlane Tools 322

Installing Fastlane 323

Installing via Homebrew 324

Installing via RubyGems 324

Installing via Direct Download 324

Setting Up a Project 324

Doing a Build 325

Configuring a Fastfile 327

20 Using Fastlane's Tools 329

Code Signing with match 329

The Problem That Match Solves 329

Match's Solution 332

Generating Screenshots Using snapshot 333

Using Boarding to Add Testers to TestFlight 337

Managing Your Apps Presence on the App Store Using deliver 339

Getting the Metadata 340

Submitting New Metadata 340

Looking Further 341

Index 343

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews