Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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
Swift Protocol-Oriented Programming

You're reading from   Swift Protocol-Oriented Programming Increase productivity and build faster applications with Swift 5

Arrow left icon
Product type Paperback
Published in Jun 2019
Publisher
ISBN-13 9781789349023
Length 224 pages
Edition 4th 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 (11) Chapters Close

Preface 1. Starting with the Protocol 2. Our Type Choices FREE CHAPTER 3. Extensions 4. Generics 5. Memory Management 6. Object-Oriented Programming 7. Protocol-Oriented Programming 8. Adopting Design Patterns in Swift 9. Case Studies 10. Other Books You May Enjoy

What this book covers

Chapter 1, Starting with the Protocol, looks at what protocols are and how they are used in the Swift programming language. We will also examine how protocols can be used to write very flexible and reusable code.

Chapter 2, Our Type Choices, discusses the different types that Swift offers (structs, classes, enums, and tuples). We will look at several examples of when to use the various types and when not to.

Chapter 3, Extensions, looks at how extensions and protocol extensions are used with the Swift programming language. We will look at examples of how extensions can be used with protocol-oriented programming.

Chapter 4, Generics, shows how powerful generics are. Apple has stated that Generics are one of the most powerful features of Swift. We will look at how to use Generics to make very flexible types, and also how to implement the Copy-on-Write (COW) feature for our custom types.

Chapter 5, Memory Management, looks at how Swift manages memory with Automatic Reference Counting (ARC) and how strong reference cycles can cause ARC to fail. We also look at how to use weak and unowned references.

Chapter 6, Object-Oriented Programming, examines how we would develop characters for a video game if we were taking an object-oriented approach. In order to really appreciate the ideas behind protocol-oriented programming, we need to understand the problems it is designed to solve. We will then look at the drawbacks with this design.

Chapter 7, Protocol-Oriented Programming, develops the same video game characters from Chapter 5, Memory Management, but this time we will take a protocol-oriented approach to the design. We will then compare the object-oriented approach and the protocol-oriented approach to see the advantages that the protocol-oriented approach offers.

Chapter 8, Adopting Design Patterns in Swift, looks at implementing several design patterns using protocol-oriented programming. For each of the design patterns, we will look at the problem they are designed to solve and how to implement the pattern.

Chapter 9, Case Studies, explores two case studies. This chapter is designed to pull everything from the first six chapters together to show you how to use protocol-oriented programming in real-world situations.

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 £16.99/month. Cancel anytime