31,19 €
Swift is an exciting, multi-platform, general-purpose programming language, and with this book, you'll explore the features of its latest version, Swift 5.3.
The book begins with an introduction to the basic building blocks of Swift 5.3, its syntax, and the functionalities of Swift constructs. You’ll then discover how Swift Playgrounds provide an ideal platform to write, execute, and debug your Swift code. As you advance through the chapters, the book will show you how to bundle variables into tuples or sets, order your data with an array, store key-value pairs with dictionaries, and use property observers. You’ll also get to grips with the decision-making and control structures in Swift, examine advanced features such as generics and operators, and explore functionalities outside of the standard library. Once you’ve learned how to build iOS applications using UIKit, you'll find out how to use Swift for server-side programming, run Swift on Linux, and investigate Vapor. Finally, you'll discover some of the newest features of Swift 5.3 using SwiftUI and Combine to build adaptive and reactive applications, and find out how to use Swift to build and integrate machine learning models along with Apple’s Vision Framework.
By the end of this Swift book, you'll have discovered solutions to boost your productivity while developing code using Swift 5.3.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 518
Veröffentlichungsjahr: 2021
Copyright © 2021 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 authors, 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.
Group Product Manager: Ashwin NairPublishing Product Manager: Rohit RajkumarSenior Editor:Keagan CarneiroContent Development Editor:Divya VijayanTechnical Editor:Deepesh PatelCopy Editor:Safis EditingProject Coordinator:Kinjal BariProofreader: Safis EditingIndexer:Manju ArasanProduction Designer:Alishon Mendonca
First published: September 2017 Second edition: February 2021
Production reference: 1260221
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-83921-119-5
www.packt.com
Contributors
Keith Moonis an award-winning iOS developer, author, and speaker based in London. He has worked with some of the biggest companies in the world to create engaging and personal mobile experiences. Keith has been developing in Swift since its release, working on projects that are both fully Swift and mixed Swift and Objective-C. Keith has been invited to speak about Swift development at conferences from Moscow to Minsk and London.
Chris Barker is an iOS developer and tech lead for fashion retailer N Brown (JD Williams, SimplyBe, Jacamo), where he heads up the iOS team. Chris started his career developing .NET applications for online retailer dabs.com (now BT Shop) before he made his move into mobile app development with digital agency Openshadow (now MyStudioFactory Paris). There, he worked on mobile apps for clients such as Louis Vuitton, L'Oréal Paris, and the Paris Metro. Chris often attends and speaks at local iOS developer meetups and conferences such as NSManchester, Malaga Mobile, and CodeMobile.
Juan Catalan is a software developer with more than 10 years of experience, having started learning iOS almost since its beginnings. He has worked as a professional iOS developer in many industries, including industrial automation, transportation, document management, fleet tracking, real estate, and financial services. Juan has contributed to more than 30 published apps, some of which have millions of users. He has a passion for software architecture, always looking for ways to write better code and optimize mobile apps.
George MacKay-Shore is an experienced software engineer who has worked in almost every field of the computing industry. His expertise ranges from embedded systems to games; from the public sector to FinTech; and all that is in between. He has a wide range of experience with many programming languages including C/C++, Swift, Java, TypeScript, and Python to name a few, and always strives to learn the newest innovative technologies.
Title Page
Copyright and Credits
Swift Cookbook Second Edition
Dedication
Contributors
About the authors
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Code in Action
Download the color images
Conventions used
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Get in touch
Reviews
Swift Building Blocks
Technical requirements
Creating your first Swift program
Getting ready
How to do it...
There's more...
See also
Using Strings, Ints, Floats, and Bools
Getting ready
How to do it...
How it works...
There's more...
See also
Unwrapping optionals, and force unwrapping
Getting started
How to do it...
How it works...
There's more...
See also
Reusing code in functions
How to do it...
There's more...
Default parameter values
Parameter overloading
See also
Encapsulating functionality in object classes
How to do it...
How it works...
There's more...
See also
Bundling values into structs
Getting ready
How to do it...
How it works...
There's more...
See also
Enumerating values with enums
Getting ready
How to do it...
How it works...
There's more...
Methods and computed variables
Associated values
See also
Passing around functionality with closures
Getting ready
How to do it...
How it works...
There's more...
See also
Using protocols to define interfaces
Getting ready
How to do it...
How it works...
There's more...
See also
Mastering the Building Blocks
Technical requirements
Bundling variables into tuples
Getting ready
How to do it...
How it works...
There's more...
See also
Ordering your data with arrays
Getting started
How to do it...
How it works...
There's more...
See also
Containing your data in sets
How to do it...
How it works...
Union
Intersection
Symmetric difference
Subtracting
Membership comparison
See also
Storing key-value pairs with dictionaries
Getting ready
How to do it...
How it works...
There's more...
See also
Subscripts for custom types
Getting ready
How to do it...
How it works...
There's more...
See also
Changing your name with typealias
How to do it...
There's more...
See also
Getting property changing notifications using property observers
Getting ready
How to do it...
How it works...
There's more...
See also
Extending functionality with extensions
Getting ready
How to do it...
How it works...
There's more...
See also
Controlling access with access control
Getting ready
How to do it...
How it works...
There's more...
See also
Data Wrangling with Swift Control Flow
Technical requirements
Making decisions with if/else
Getting ready
How to do it...
How it works...
There's more...
Understanding conditional unwrapping
Chaining optional unwrapping
Using enums with associated values
See also
Handling all cases with switch
Getting ready
How to do it...
How it works...
See also
Looping with for loops
How to do it...
How it works...
See also
Looping with while loops
Getting ready
How to do it...
How it works...
There's more...
See also
Handling errors with try, throw, do, and catch
How to do it...
How it works...
There's more...
See also
Checking upfront with guard
Getting ready
How to do it...
How it works...
There's more...
See also
Doing it later with defer
Getting ready
How to do it...
How it works...
There's more...
See also
Bailing out with fatalError and precondition
Getting ready
How to do it...
How it works...
See also
Generics, Operators, and Nested Types
Technical requirements
Using generics with types
Getting ready
How to do it...
How it works...
There's more...
See also
Using generics with functions
How to do it...
How it works...
There's more...
See also
Using generics with protocols
How to do it...
How it works...
There's more...
See also
Using advanced operators
How to do it...
See also
Defining option sets
How to do it...
How it works...
See also
Creating custom operators
Getting ready
How to do it...
How it works...
There's more...
See also
Nesting types and namespacing
How to do it...
How it works...
There's more...
See also
Beyond the Standard Library
Technical requirements
Comparing dates with Foundation
Getting ready
How to do it...
How it works...
See also
Fetching data with URLSession
Getting ready
How to do it...
How it works...
See also
Working with JSON
Getting ready
How to do it...
There's more...
Working with XML
Getting ready
How to do it...
How it works...
There's more...
See also
Building iOS Apps with Swift
Technical requirements
Building an iOS App using Cocoa Touch
Getting ready
How to do it...
How it works...
There's more...
See also
Unit and integration testing with XCTest
Getting ready
How to do it...
How it works...
There's more...
See also
User interface testing with XCUITest
Getting ready
How to do it...
There's more...
See also
Backward compatibility
How to do it...
There's more...
See also
Swift Playgrounds
Technical requirements
Using Swift Playgrounds for UI
Getting ready
How to do it...
How it works...
There's more...
See also
Importing resources into playgrounds
Getting ready
How to do it...
How it works...
See also
Importing code into playgrounds
Getting ready
How to do it...
How it works...
See also
Multi-page playgrounds
Getting ready
How to do it...
How it works...
There's more...
See also
Using Swift Playgrounds on iPadOS
Getting ready
How to do it...
How it works...
There's more
See also
Server-Side Swift
Technical requirements
Running Swift on Linux
Getting started
How to do it...
There's more...
Building a REST API using Vapor and Fluent
Getting started
How to do it...
How it works...
There's more...
See also
Database persistence with Fluent and Postgres
Getting ready
How to do it...
How it works...
See also
Hosting your Vapor app on Heroku
Getting started
How to do it...
See also
The Swift Package Manager
Getting started
How to do it...
How it works...
There's more...
See also
Real-time communication using WebSockets
Getting started
How to do it...
How it works...
There's more...
See also
Packaging and sharing models between server and app
Getting started
How to do it...
How it works...
There's more...
Performance and Responsiveness in Swift
Technical requirements
Value and reference semantics
Getting ready
How to do it...
How it works...
See also
Using Dispatch queues for concurrency
Getting ready
How to do it...
How it works...
See also
Concurrent queues and dispatch groups
Getting ready
How to do it...
How it works...
See also
Implementing the operation class
Getting ready
How to do it...
How it works...
See also
SwiftUI and Combine Framework
Technical requirements
Declarative syntax
Getting ready
How to do it...
How it works...
There's more...
See also
Function builders, property wrappers, and opaque return types
Getting ready
How to do it...
There's more...
See also
Building simple views in SwiftUI
Getting ready
How to do it...
How it works...
There's more...
See also
Combine and data flow in SwiftUI
Getting ready
How to do it...
How it works...
See also
Using CoreML and Vision in Swift
Technical requirements
Building an image capture app
Getting ready
How to do it...
How it works...
There's more...
See also
Using CoreML models to detect objects in images
Getting ready
How to do it...
How it works...
There's more...
See also
Building a video capture app
Getting ready
How to do it...
How it works...
There's more...
See also
Using CoreML and the Vision Framework to detect objects in real time
Getting ready
How to do it...
How it works...
See also
About Packt
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Leave a review - let other readers know what you think
