Book Image

Swift 4 Protocol-Oriented Programming - Third Edition

By : Jon Hoffman
Book Image

Swift 4 Protocol-Oriented Programming - Third Edition

By: Jon Hoffman

Overview of this book

Swift has become the number one language used in iOS and macOS development. The Swift standard library is developed using protocol-oriented programming techniques, generics, and first-class value semantics; therefore, every Swift developer should understand these powerful concepts and how to take advantage of them in their application design. This book will help you understand the differences 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 a solid knowledge of the various types that can be used in Swift and the differences between value and reference types. You will be taught how protocol-oriented programming techniques can be used to develop very flexible and easy-to-maintain code. By the end of the book, you will have a thorough understanding of protocol-oriented programming and how to utilize it to build powerful and practical applications.
Table of Contents (15 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Chapter 5. Object-Oriented Programming

I was first introduced to object-oriented programming in college where I had a brief introduction to C++. At the time, the C++ programming language was still relatively new. In fact, the first edition of the language was only released three years prior to my introduction to it. The object-oriented programming paradigm was a radical departure from the procedural programming paradigm that I learned in the past and at the time seemed quite overwhelming. Even though I was introduced to object-oriented programming with C++, I really did not do any serious development with it until I learned Java much later.

In this chapter, you will learn the following:

  • How Swift can be used as an object-oriented programming language
  • How we can develop an API in an object-oriented way
  • What are the benefits of an object-oriented design
  • What are the drawbacks of object-oriented programming

While this book is about protocol-oriented programming, we really need to discuss how Swift...