Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Protocol-Oriented Programming with Swift
Table of Contents
Protocol-Oriented Programming with Swift
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
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
Protocol and protocol extensions versus superclasses
Implementing drink types
Value types vs reference types
The winner is...
Summary
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
3. Catching Our Errors
Using the guard statement
Error handling
Error handling with return values
Error handling with NSError
Error handling with Swift 2
Representing errors
Throwing errors
Catching errors
When to use error handling
Summary
4. All about the Protocol
Protocol syntax
Defining a protocol
Property requirements
Method requirements
Optional requirements
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
5. Let's Extend Some Types
Defining an extension
Protocol extensions
Text validation
Summary
6. Adopting Design Patterns in Swift
What are design patterns?
Creational patterns
The singleton design pattern
Understanding the problem
Understanding the solution
Implementing the singleton pattern
The builder design pattern
Understanding the problem
Understanding the solution
Implementing the builder pattern
The factory method pattern
Understanding the problem
Understanding the solution
Implementing the factory method pattern
Structural design patterns
The bridge pattern
Understanding the problem
Understanding the solution
Implementing the bridge pattern
The façade pattern
Understanding the problem
Understanding the solution
Implementing the façade pattern
The proxy design pattern
Understanding the problem
Understanding the solution
Implementing the proxy pattern
Behavioral design patterns
The command design pattern
Understanding the problem
Understanding the solution
Implementing the command pattern
The strategy pattern
Understanding the problem
Understanding the solution
Implementing the strategy pattern
The observer pattern
Understanding the problem
Understanding the solution
Implementing the observer pattern
Summary
7. Case Studies
Logging service
Requirements
The design
Conclusion
Data access layer with SQLite.swift
Requirements
The design
Connection layer
Data model layer
Data helper layer
Conclusion
Calculator application
Requirements
The design
Conclusion
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →