Swift 3 Protocol-Oriented Programming - Second Edition

Build fast and powerful applications with the power of protocol-oriented programming

Swift 3 Protocol-Oriented Programming - Second Edition

This ebook is included in a Mapt subscription
Jon Hoffman

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

Book Details

ISBN 139781787129948
Paperback218 pages

Book Description

One of the most important additions to the new features and capabilities of the Swift programming language was an overhaul of Protocols. Protocol-oriented programming and first class value semantics have now become two incredibly powerful concepts at the heart of Swift’s design.

This book will help you understand the difference between object-oriented programming and protocol-oriented programming. It will demonstrate how to work with protocol-oriented programming using real world use cases. You will gain solid knowledge of the different types that can be used in Swift and the differences between value and reference types. You will be taught how to utilize the advanced features of protocol-oriented programming to boost the performance of your applications.

By the end of the book, you will have a thorough understanding of protocol-oriented programming and how to utilize it to build powerful, practical applications.

Table of Contents

Chapter 1: Object-Oriented and Protocol-Oriented Programming
What is object-oriented programming?
Requirements for the sample code
Swift as an object-oriented programming language
Drawbacks to object-oriented design
Swift as a protocol-oriented programming language
Summarizing protocol-oriented programming and object-oriented programming
Differences between object-oriented programming and protocol-oriented programming
The winner is...
Summary
Chapter 2: Our Type Choices
The class
The structure
Access controls
The enumerations
The tuple
Protocols
Value and reference types
Recursive data types for reference types only
Inheritance for reference types only
Swift's 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 do-catch
Using the defer statement
When to use error handling
Summary
Chapter 4: All About the Protocol
Protocol syntax
Protocol inheritance
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: Lets Extend Some Types
Defining an extension
Protocol extensions
Text validation
Summary
Chapter 6: Working with Generics
Generic functions
Type constraints with generics
Generic types
Associated types
Generics in a protocol-oriented design
Summary
Chapter 7: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary
Chapter 8: Case Studies
Logging service
Data access layer
Calculator application
Summary

What You Will Learn

  • Understand the difference between object-oriented programming and protocol-oriented programming
  • Explore the different types that Swift offers and what pitfalls to avoid
  • Error handling with do-try-catch block
  • Delve into Generics and Generic programming
  • Implement several design patterns in a protocol-oriented way
  • How to design applications by prioritizing the protocol first and the actual type second

Authors

Table of Contents

Chapter 1: Object-Oriented and Protocol-Oriented Programming
What is object-oriented programming?
Requirements for the sample code
Swift as an object-oriented programming language
Drawbacks to object-oriented design
Swift as a protocol-oriented programming language
Summarizing protocol-oriented programming and object-oriented programming
Differences between object-oriented programming and protocol-oriented programming
The winner is...
Summary
Chapter 2: Our Type Choices
The class
The structure
Access controls
The enumerations
The tuple
Protocols
Value and reference types
Recursive data types for reference types only
Inheritance for reference types only
Swift's 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 do-catch
Using the defer statement
When to use error handling
Summary
Chapter 4: All About the Protocol
Protocol syntax
Protocol inheritance
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: Lets Extend Some Types
Defining an extension
Protocol extensions
Text validation
Summary
Chapter 6: Working with Generics
Generic functions
Type constraints with generics
Generic types
Associated types
Generics in a protocol-oriented design
Summary
Chapter 7: Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
Structural design patterns
Behavioral design patterns
Summary
Chapter 8: Case Studies
Logging service
Data access layer
Calculator application
Summary

Book Details

ISBN 139781787129948
Paperback218 pages
Read More
From 1 reviews

Read More Reviews