Скачать книгу

and macOS applications. With SwiftUI, Apple aims to modernize the iOS development experience.

      There’s no doubt that SwiftUI makes it much easier and more efficient for developers to create apps, but it also means you have to learn something new. That’s where SwiftUI For Dummies comes in. This book provides you with all the essentials that you need to learn to become a successful iOS developer using SwiftUI.

      This book covers the basics of SwiftUI. Because SwiftUI supports iOS, iPadOS, macOS, watchOS, and tvOS, it’s a really big topic. To narrow the scope, this book focuses on using SwiftUI with iOS, specifically to program iPhone apps.

      In this code-intensive book, you’re encouraged to try out the examples in each chapter. The chapters are designed to be compact, easy to follow, and easy to understand. However, you don’t have to read this book from the first page to the last. Each chapter is designed to be independent, and you’re free to start with any chapter to find the topic that you’re interested in.

      I don’t use many special conventions, but here are a couple points you should be aware of: Sidebars (text in gray boxes) and anything marked with the Technical Stuff icon are skippable, and code appears in monofont. Pretty simple, right?

      Finally, within this book, you may note that some web addresses break across two lines of text. If you're reading this book in print and want to visit one of these web pages, simply key in the web address exactly as it’s noted in the text, pretending as though the line break doesn’t exist. If you’re reading this as an e-book, you’ve got it easy — just click the web address to be taken directly to the web page.

      This book is for people who are new (or relatively new) to using SwiftUI for iOS development. Though I do not assume that you’re familiar with iOS programming, I do assume the following:

       You’re familiar with the basics of programming.

       You’re familiar with how an iPhone works.

       You have a Mac that you can use to try out the examples in this book.

       You don’t need an iPhone to test the applications in this book (except for Chapter 12 where I show you how to load your iPhone with the application you’ve built); the iPhone Simulator will suffice.

      Some chapters in this book assume that you’re familiar with UIKit programming (the framework used for iOS programming prior to SwiftUI). But this knowledge is not a prerequisite for using this book.

      Like other books in the For Dummies series, this book uses icons, or little pictures in the margins, to draw your attention to certain kinds of material. Here are the icons that I use:

      

Whenever I tell you something useful or important enough that you’d do well to store the information somewhere safe in your memory for later recall, I flag it with the Remember icon.

      

The Technical Stuff icon marks text that contains some for-nerds-only technical details or explanations that you’re free to skip.

      

The Tip icon marks shortcuts or easier ways to do things, which I hope will make your life easier.

      

The Warning icon marks text that contains a friendly but unusually insistent reminder to avoid doing something. You have been warned.

      In addition to what you’re reading right now, this product comes with a free access-anywhere Cheat Sheet that includes information on creating a stacked and table navigation app, creating shake fail feedback using animation, and more. To get this Cheat Sheet, go to www.dummies.com and type SwiftUI For Dummies Cheat Sheet in the Search box.

      This book includes some downloadable content as well — all the code in the book, as well as the files you need to create the app described in the book. Go to www.dummies.com/go/swiftuifd to download all this great stuff.

      The first step to go from here is to prepare your Mac. If you’ve never programmed an iOS app, now is the time to download and install Xcode (see Chapter 1). If you’re a seasoned iOS developer, you’ll appreciate the fact that Chapter 1 also compares the old way of doing things using the UIKit and the new way of doing things in SwiftUI.

      Chapter 2 provides a quick overview of the Swift programming language, which is the language used in SwiftUI. Learning a new language is not trivial, so I strongly suggest you go through the basics of Swift (even if you’re already familiar with it) so that you can learn some of the new language features in the latest version of Swift. You may also want to refer to Apple’s documentation on the Swift programming language at https://docs.swift.org/swift-book.

      Beyond that, feel free to jump to any chapter that piques your interest. That being said, if you’re a SwiftUI newbie, it makes sense to follow the chapters in order.

      Finally, my advice to all beginners is: Practice, practice, practice. Type in the code in each chapter and make mistakes. The more mistakes you make, the better you’ll understand and remember the topics discussed.

      Good luck, and enjoy your newfound knowledge!

      Getting Started with Swift and SwiftUI

      Get a head start in using SwiftUI and build your first iOS app.

      Get acquainted with the syntax of the Swift programming language so that you’re prepared to dive into the world of SwiftUI.

      Introducing SwiftUI

      IN THIS CHAPTER

      

Understanding what SwiftUI is

      

Getting the tools for SwiftUI

      

Comparing UIKit to SwiftUI

      

Using the preview canvas and Live Preview

       Скачать книгу