ENGLISH

Swift 5.3 Cookbook: Improve productivity by applying proven recipes to develop code using the latest version of Swift

Book information

Publisher
Packt Publishing
Year
2021
ISBN
148426701X, 9781484267011
Language
english
Format
PDF
Filesize
21 MB (21951267 bytes)
Edition
2
Pages
290\488
Time added
2021-02-27 11:14:56

Description

Discover code-rich recipes ideal for developers new to Swift and those looking to explore the latest features of Swift 5.3 Key FeaturesLearn Swift 5.3 programming techniques to write robust and efficient codeDiscover the fundamentals of the Swift programming language and build apps with frameworks such as Foundation, Networking, and UIKitGet to grips with the new features of Swift 5.3, including SwiftUIBook Description Swift is an exciting, multi-platform, general-purpose programming language, and this book will help you 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 learn about 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. By the end of the book, you'll have discovered direct solutions that will help you become productive while developing code using Swift 5.3. What you will learnExplore basic to advanced concepts in Swift 5.3 programmingUnderstand conditional statements, loops, and how to handle errors in SwiftDefine flexible classes and structs using genericsUse advanced operators and create custom onesBuild iOS apps using the powerful features of UIKit or the new SwiftUI frameworkImport your own custom functionality into Swift PlaygroundsRun Swift on Linux and investigate server-side programming with the server-side framework VaporWho This Book Is For If you are looking to get started with Swift 5.3 or want to learn about the diverse features it offers, along with tips and tricks to efficiently code and build applications, then this book is for you. Basic knowledge of general programming concepts will assist with understanding key concepts. Table of ContentsSwift Building BlocksBuilding on the Building BlocksData Wrangling with Swift Control FlowGenerics, Operators, and Nested TypesBeyond the Standard LibraryBuilding iOS Apps with SwiftSwift PlaygroundsServer-Side SwiftPerformance and Responsiveness in SwiftSwiftUI and CombineSwift for Machine Learning Cover Title Page Copyright and Credits Dedication Contributors Table of Contents Preface Chapter 1: 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 Chapter 2: 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 Chapter 3: 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 Chapter 4: 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 Chapter 5: 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 Chapter 6: 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 Chapter 7: 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 Chapter 8: 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... Chapter 9: 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 Chapter 10: 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 Chapter 11: 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 Other Books You May Enjoy Index

Similar books