Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Swift

You're reading from   Mastering Swift

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher Packt
ISBN-13 9781784392154
Length 358 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jon Hoffman Jon Hoffman
Author Profile Icon Jon Hoffman
Jon Hoffman
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Taking the First Steps with Swift FREE CHAPTER 2. Learning about Variables, Constants, Strings, and Operators 3. Using Collections and Cocoa Data Types 4. Control Flow and Functions 5. Classes and Structures 6. Working with XML and JSON Data 7. Custom Subscripting 8. Using Optional Type and Optional Chaining 9. Working with Generics 10. Working with Closures 11. Using Mix and Match 12. Concurrency and Parallelism in Swift 13. Swift Formatting and Style Guide 14. Network Development with Swift 15. Adopting Design Patterns in Swift Index

What this book covers

Chapter 1, Taking the First Steps with Swift, introduces the reader to the Swift programming language and discusses what inspired Apple to create Swift. We also go over the basic syntax of Swift and how to use Playgrounds to experiment and test Swift code.

Chapter 2, Learning about Variables, Constants, Strings, and Operators, explains to the reader about variables and constants in Swift and when to use them. There are brief overviews of the most common variable types, with examples of how to use them. We conclude this chapter by showing examples of how to use the most common operators in the Swift language.

Chapter 3, Using Collections and Cocoa Data Types, introduces Swift's Array and Dictionary collection types and shows examples of how to use them. We will also show how to use the Cocoa and Foundation data types with Swift.

Chapter 4, Control Flow and Functions, explains how to use Swift's control flow statements. These include looping, conditional, and control transfer statements. The second half of the chapter is all about functions and how to define and use them.

Chapter 5, Classes and Structures, explains Swift's classes and structures in detail. We will look at what makes them similar and what makes them different. We will also look at access controls and object-oriented design. We will close this chapter out by looking at memory management in Swift.

Chapter 6, Working with XML and JSON Data, starts off by discussing what XML and JSON data is and their uses. We then show several examples of how to parse and build XML and JSON data using Apple's frameworks.

Chapter 7, Custom Subscripting, examines how we can use custom subscripts in our classes, structures, and enumerations. Subscripts in Swift can be used to access elements in a collection. We can also define custom subscripts for our classes, structures, and enumerations.

Chapter 8, Using Optional Type and Optional Chaining, looks at what optional types really are, various ways to unwrap them, and optional chaining. For a developer just learning Swift, optional types can be one of the most confusing items to learn.

Chapter 9, Working with Generics, allows us to write very flexible and reusable code that avoids duplication. In this chapter, we will examine how Swift implements generics. We will also look at the proper ways to use generics in our code.

Chapter 10, Working with Closures, examines how to define and use closures in our code. We will conclude this chapter with a section on how to avoid strong reference cycles with closures. Closures in Swift are similar to blocks in Objective-C, except that they have a much cleaner and easier-to-use syntax.

Chapter 11, Using Mix and Match, examines mix and match and demonstrates how we can include Swift code in our Objective-C projects and Objective-C code in our Swift projects. With all of the apps and frameworks written in Objective-C, it was important to allow Swift and Objective-C code to work together.

Chapter 12, Concurrency and Parallelism in Swift, shows how to use both Grand Central Dispatch (GCD) and Operation Queues to add concurrency and parallelism to our applications. Understanding and knowing how to add concurrency and parallelism to our apps can significantly enhance the user experience.

Chapter 13, Swift Formatting and Style Guide, defines a style guide for the Swift language that can be a template for enterprise developers that need to create a style guide. Most enterprises have style guides for the various languages that they develop in.

Chapter 14, Network Development with Swift, looks at the Apple APIs to connect to remote severs and how to best use them. Network development can be both fun and challenging.

Chapter 15, Adopting Design Patterns in Swift, examines how to implement some of the more common design patterns in Swift. A design pattern identifies a common software development problem and provides a strategy for dealing with it.

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image