Protocol-Oriented Programming with Swift

Build fast and powerful applications by exploiting the power of protocol-oriented programming in Swift

Protocol-Oriented Programming with Swift

This ebook is included in a Mapt subscription
Jon Hoffman

2 customer reviews
Build fast and powerful applications by exploiting the power of protocol-oriented programming in Swift
$10.00
$39.99
RRP $31.99
RRP $39.99
eBook
Print + eBook
Preview in Mapt

Book Details

ISBN 139781785882944
Paperback212 pages

Book Description

At the heart of Swift's design is an incredibly powerful idea: protocol-oriented programming. Its many benefits include better code maintainability, increased developer productivity and superior application performance. The book will teach the reader how to apply the ideas behind the protocol oriented programing paradigm to improve the code they write.

This book will introduce the readers to the world of protocol-oriented programming in Swift and will demonstrate the ideas behind this new programming paradigm with real world examples. In addition to learning the concepts of Protocol Oriented programming, it also shows the reader how to reduce the complexity of their codebase using protocol extensions. Beginning with how to create simple protocols, readers will learn how to extend protocols and also to assign behaviors to them.

By the end of this book readers will be able to harness the power of protocol-oriented programming to build real world applications.

Table of Contents

Chapter 1: Object-Oriented and Protocol-Oriented Programming
Swift as an object-oriented programming language
Swift as a protocol-oriented programming language
Summarizing protocol-oriented programming and object-oriented programming
Object-oriented programming versus protocol-oriented programming
The winner is...
Summary
Chapter 2: Our Type Choices
The class
The structure
The enumerations
The tuple
Protocols
Value versus class types
Recursive data types (reference types only)
Inheritance (reference types only)
Swift built-in data types and data structures
Summary
Chapter 3: Catching Our Errors
Using the guard statement
Error handling
Error handling with return values
Error handling with NSError
Error handling with Swift 2
When to use error handling
Summary
Chapter 4: All about the Protocol
Protocol syntax
Protocol composition
Using protocols as a type
Polymorphism with protocols
Type casting with protocols
Associated types with protocols
Delegation
Designing and developing with protocols
Summary
Chapter 5: Let's Extend Some Types
Defining an extension
Protocol extensions
Text validation
Summary
Chapter 6: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary
Chapter 7: Case Studies
Logging service
Data access layer with SQLite.swift
Calculator application
Summary

What You Will Learn

  • The difference between Object-Oriented programming and Protocol-Oriented programming
  • The difference between reference and value types and when to use each
  • How we can leverage tuples to reduce the complexity of our code
  • What are protocols and how to use them
  • How to implement protocol extensions to create a very flexible code base
  • How to implement several design patterns in a Protocol-Oriented approach
  • How to solve real world design issue with protocol oriented programming

Authors

Table of Contents

Chapter 1: Object-Oriented and Protocol-Oriented Programming
Swift as an object-oriented programming language
Swift as a protocol-oriented programming language
Summarizing protocol-oriented programming and object-oriented programming
Object-oriented programming versus protocol-oriented programming
The winner is...
Summary
Chapter 2: Our Type Choices
The class
The structure
The enumerations
The tuple
Protocols
Value versus class types
Recursive data types (reference types only)
Inheritance (reference types only)
Swift built-in data types and data structures
Summary
Chapter 3: Catching Our Errors
Using the guard statement
Error handling
Error handling with return values
Error handling with NSError
Error handling with Swift 2
When to use error handling
Summary
Chapter 4: All about the Protocol
Protocol syntax
Protocol composition
Using protocols as a type
Polymorphism with protocols
Type casting with protocols
Associated types with protocols
Delegation
Designing and developing with protocols
Summary
Chapter 5: Let's Extend Some Types
Defining an extension
Protocol extensions
Text validation
Summary
Chapter 6: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary
Chapter 7: Case Studies
Logging service
Data access layer with SQLite.swift
Calculator application
Summary

Book Details

ISBN 139781785882944
Paperback212 pages
Read More
From 2 reviews

Read More Reviews