Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Swift Cookbook - Second Edition

You're reading from  Swift Cookbook - Second Edition

Product type Book
Published in Feb 2021
Publisher Packt
ISBN-13 9781839211195
Pages 500 pages
Edition 2nd Edition
Languages
Authors (2):
Keith Moon Keith Moon
Profile icon Keith Moon
Chris Barker Chris Barker
Profile icon Chris Barker
View More author details

Table of Contents (14) Chapters

Preface 1. Swift Building Blocks 2. Mastering the Building Blocks 3. Data Wrangling with Swift Control Flow 4. Generics, Operators, and Nested Types 5. Beyond the Standard Library 6. Building iOS Apps with Swift 7. Swift Playgrounds 8. Server-Side Swift 9. Performance and Responsiveness in Swift 10. SwiftUI and Combine Framework 11. Using CoreML and Vision in Swift 12. About Packt 13. Other Books You May Enjoy

What this book covers

Chapter 1, Swift Building Blocks, introduces you to the basic building blocks of Swift 5, its syntax, and the functionalities of basic Swift constructs. Also, this chapter will introduce you to Apple’s Xcode IDE and Swift Playgrounds, which provides an ideal way to create, execute, debug, and understand the recipes contained in this book, thus setting you up to initiate the development process. In this chapter, you will learn how to write your first Swift program and understand the various basic elements of the Swift language.

Chapter 2, Mastering the Building Blocks, teaches you how to create more complex structures on the basis of the building blocks that you studied in the first chapter and the functionalities provided by the Swift standard library. You will get an understanding of how to bundle variables into tuples, order data with the help of an array, and store key-value pairs with dictionaries. You will also learn how to use the property observers and control the access to and visibility of your code. Then, you will learn how to extend the functionalities of your code using the extensions.

Chapter 3, Data Wrangling with Swift Control Flow, will teach you that programming is all about making decisions, therefore in this chapter, we will explore how to make decisions on the basis of the information gained and how to alter the control flow of the code. You will learn how to conditionally execute your code with if/else statements. You will also learn how to control the flow of execution of your code with switch statements, and then loop this code by understanding how to use for and while loops. You will then understand how to handle Swift errors with try, throw, do, and catch statements. Also, we will cover how a defer statement can be useful to change state once a function's execution is complete or to clean up values that are no longer needed.

Chapter 4, Generics, Operators, and Nested Types, provides you with an understanding of two advanced features of Swift, which are generics and operators. Using these features, you will learn how to build functionalities that are flexible and well defined. Also, you will understand how nested types allow logical grouping, access, and namespacing for your constructs.

Chapter 5, Beyond the Standard Library, takes you on a journey to explore the functionalities beyond the standard library provided by frameworks such as Foundation and UIKit. Learning how to use these functionalities will help you make full use of the Swift language.

Chapter 6, Building iOS Apps with Swift, is where we'll start the journey into building our very own iOS app. Taking everything we've learned and more from the previous chapters' recipes, this chapter will teach you how to get off the ground using Swift to build an iOS app.

Chapter 7, Swift Playgrounds, is where you will gain a total understanding of using Swift Playgrounds and explore advanced features other than those explored in previous chapters, to create fully interactive experiences.

Chapter 8, Server-Side Swift, introduces you to a totally different aspect of Swift programming: server-side programming with Swift. Also, you will gain an understanding of how to run Swift on Linux by installing the Swift toolchain. You will learn how to use a web server framework to build a REST API and how to host your API via a hosting service. You will also learn how to accomplish your tasks easily by understanding how to use Vapor, one of the most popular frameworks of Swift 5.

Chapter 9, Performance and Responsiveness in Swift, explores the more advanced concepts of Swift programming to provide an understanding of how certain Swift types are implemented and their performance characteristics. Also, you will learn how to perform asynchronous tasks using the Grand Central Dispatch API. Then, we'll explore the multi-threaded environment available on all Apple platforms and how to enhance the performance profile of your Swift constructs to build a fast and responsive app.

Chapter 10, SwiftUI and Combine Framework, dives straight into Apple's new UI framework, SwiftUI. With SwiftUI, we'll learn how to create iOS apps by exploring the declarative syntax used to achieve this. We'll also explore how easy it is for SwiftUI and UIKit to work together. In addition to SwiftUI, we'll also explore the basics of the new Combine framework and how this works alongside SwiftUI.

Chapter 11, Using CoreML and Vision in Swift, will dive into the frameworks offered by Apple and how we can use Swift code to harness machine learning techniques, as machine learning is becoming an increasingly hot topic. In this chapter, we'll cover CoreML and the Vision frameworks, using pre-trained models to identify objects in real time.

lock icon The rest of the chapter is locked
Next Chapter arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}