ebook img

Learn iOS 11 Programming with Swift 4 PDF

794 Pages·2018·77.073 MB·English
by  ClaytonCraig
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learn iOS 11 Programming with Swift 4

Learn iOS 11 Programming CL Craig Clayton rae iga with Swift 4 - Second Edition Cr ln a y ti oO n S You want to build iOS applications Things you will learn: 1 1 but where do you start? Forget sifting P through tutorials and blog posts, this book r is a direct route into iOS development, • Get to grips with Swift 4 and o Learn iOS 11 taking you through the basics and Xcode 9, the building blocks g showing you how to put the principles of Apple development r a into practice. So take advantage of this m developer-friendly guide and start building applications that may just take the App • Get to know the fundamentals of m Programming Store by storm! Swift 4, including strings, variables, i n constants, and control fl ow g Whether you're an experienced w programmer or a complete novice, this • Discover the distinctive design i book guides you through every facet of t principles that defi ne the iOS user h with Swift 4 iOS development. From Xcode and Swift, experience S the building blocks of modern iOS w development, you'll quickly gain a solid foundation to begin venturing deeper into • Build a responsive UI and add privacy if t your development journey. Experienced to your custom-rich notifi cations 4 programmers can jump right in and learn Second Edition the latest iOS 11 features. - S • Preserve data and manipulate e You'll also learn advanced topics of iOS images with fi lters and effects c design, such as gestures and animations, to o n give your app the edge. Explore the latest d developments in Swift 4 and iOS 11 by • Bring in SiriKit to create payment incorporating new features, custom-rich requests inside your app E Learn the fundamentals of iOS app development with notifi cations, drag and drop features, and d the latest developments in SiriKit. With it Swift 4 and Xcode 9 further guidance on beta testing with • Collect valuable feedback with io TestFlight, you'll quickly learn everything TestFlight before you release n you need to get your project on the App your apps on the App Store Store! www.packtpub.com Learn iOS 11 Programming with Swift 4 Second Edition Learn the fundamentals of iOS app development with Swift 4 and Xcode 9 Craig Clayton BIRMINGHAM - MUMBAI Learn iOS 11 Programming with Swift 4 Second Edition Copyright © 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Acquisition Editor: Reshma Raman Content Development Editor: Vikas Tiwari Technical Editor: Madhunikita Sunil Chindarkar Copy Editor: Muktikant Garimella Project Coordinator: Ulhas Kambali Proofreader: Safis Editing Indexer: Tejal Daruwale Soni Graphics: Jason Monteiro, Tom Scaria Production Coordinator: Shantanu N. Zagade First published: December 2016 Second edition: January 2018 Production reference: 1290118 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78839-075-0 www.packtpub.com mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content PacktPub.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Contributors About the author Craig Clayton is a self-taught, senior iOS engineer at Adept Mobile specializing in building mobile experiences for NBA and NFL teams. He also volunteers as the organizer of the Suncoast iOS meetup group in the Tampa/St. Petersburg area, and prepares presentations and hands-on talks for this group and other groups in the community. He has also launched Cocoa Academy online, which specializes in bringing a diverse list of iOS courses ranging from building apps to games for all programming levels. About the reviewer Cecil Costa, also known as Eduardo Campos in Latin countries, is a Euro-Brazilian freelance developer. He has been giving onsite courses for companies such as Ericsson, Roche, TVE (a Spanish TV channel), and others. He has also worked for different companies, including IBM, Qualcomm, Spanish Lottery, and Dia. He is also the author of Swift Cookbook, Swift 2 Blueprints, Reactive Programming with Swift, and a video course called Building iOS 10 Applications with Swift, by Packt Publishing. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Chapter 1: Getting Familiar with Xcode 7 Getting started 8 The Xcode interface 13 Navigator panel 14 Standard editor 14 Utilities panel 15 Debug panel 15 Toolbar 15 Generic iOS device 18 iOS device 18 Connecting wirelessly 23 Window pane controls 25 Summary 27 Chapter 2: Building a Foundation with Swift 28 Playgrounds – an interactive coding environment 29 Data types – where it all starts 32 String 32 Integer data type 33 Floating-point numbers 34 Booleans 34 Variables and constants – where data is held 35 Creating a variable with a string 35 Creating a variable with an integer (Int) 36 Debug and print() – detecting your bugs 36 Adding floating-point numbers 37 Creating a Boolean 39 Hungarian notation 40 Why constants versus variables? 41 Comments – leaving yourself notes or reminders 41 Type safety and type inference 42 Concatenating strings 42 String interpolation 43 Operations with our integers 44 Table of Contents Increment and decrement 46 Comparison operators 47 Summary 47 Chapter 3: Building on the Swift Foundation 48 Creating a Playground project 49 The if statements – having fun with logic statements 50 Optionals and optional bindings 57 Why optionals? 62 Functions 63 Summary 72 Chapter 4: Digging Deeper 73 Creating a Playground project 74 Ranges 75 Closed range 75 Half-closed range 77 Control flow 78 The for...in loop 79 One-sided range 83 The while loop 84 The repeat...while loop 87 Summary 89 Chapter 5: Digging into Collections 90 Arrays 90 Creating an empty array 91 Creating an array with initial values 92 Creating a mutable array 92 Adding items to an array 93 Checking the number of elements in an array 98 Checking for an empty array 99 Retrieving a value from an array 100 Iterating over an array 104 Removing items from an array 105 Dictionaries 109 Creating a dictionary 109 Adding and updating dictionary elements 111 Accessing an item in a dictionary 115 Iterating over dictionary values 116 [ ii ] Table of Contents Iterating over dictionary keys 117 Iterating over dictionary keys and values 117 Checking the number of items in a dictionary 118 Removing items from a dictionary 121 Sets 123 Creating an empty set 124 Creating a set with an array literal 124 Creating a mutable set 125 Adding items into a set 125 Checking if a set contains an item 127 Iterating over a set 128 Intersecting two sets 131 Joining two sets 133 Removing items from a set 134 Summary 137 Chapter 6: Starting the UI Setup 138 Useful terms 139 View Controller 139 Table View Controller 139 Collection View Controller 140 Navigation Controller 141 Tab Bar Controller 142 Storyboard 143 Segue 144 Auto Layout 144 Model View Controller (MVC) 144 App tour 145 Explore tab 145 Locations 147 Restaurant listings 147 Restaurant detail 149 Map tab 150 Project setup 151 Creating a new project 151 Summary 154 Chapter 7: Setting Up the Basic Structure 155 Starting from scratch 155 Storyboard setup 157 [ iii ] Table of Contents Adding our app assets 161 Storyboards 174 Creating our launch screen 175 Adding a Navigation Controller 184 Summary 188 Chapter 8: Building Our App Structure in Storyboard 189 Adding a Collection View Controller 192 Hooking up our outlets 195 Creating a custom color 201 Setting up our cell 205 Section header 207 Updating the grid 211 Adding a modal 213 Updating Bar Button Items 221 Unwinding our Cancel button 222 Adding our first Table View 223 Summary 224 Chapter 9: Finishing Up Our App Structure in Storyboard 225 Adding our Restaurant List View 226 Hooking up our outlets 226 Setting up our cell 227 Adding Reviews View 235 Viewing reviews 237 Map Kit View 240 Summary 245 Chapter 10: Designing Cells 246 Setting up the Explore header 246 Adding Auto Layout to the Explore header 251 Setting up the Explore cell 253 Adding Auto Layout to the Explore cell 255 Setting up the Restaurant cell 256 Adding Auto Layout to the Restaurant cell 260 Location cell 263 Summary 264 Chapter 11: Designing Static Tables 265 Setting up cells 266 Creating our section headers 267 [ iv ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.