An open API service indexing awesome lists of open source software.

https://github.com/adagio/swiftadapterdp

🔌 object Adapter Design Pattern, in Swift 3.0
https://github.com/adagio/swiftadapterdp

adapter-pattern design-patterns swift-3 swift-language

Last synced: 3 months ago
JSON representation

🔌 object Adapter Design Pattern, in Swift 3.0

Awesome Lists containing this project

README

          

# Adapter Design Pattern, in Swift 3.0

This is a Structural Design Pattern

Inspired on [github ochococo/Design-Patterns-In-Swift](https://github.com/ochococo/Design-Patterns-In-Swift#-adapter)

## Pattern Definition

The adapter pattern is used to provide a link between two otherwise incompatible types by wrapping the "adaptee" with a class that supports the interface required by the client.

## Class Diagram

![Adapter Design Pattern class diagram](./Diagrams/Adapter-Design-Pattern.png)

## Class Diagram for [OldDeathStar Adapter example (@ochococo)](https://github.com/ochococo/Design-Patterns-In-Swift#-adapter)

![Class Diagram for OldDeathStar Adapter example (@ochococo)](./Diagrams/OldDeathStarAdapter.png)

## Implementation Details

I implemented a second example, the one present in [Design Patterns book by Head First](http://shop.oreilly.com/product/9780596007126.do). An implementation in Java can be found in [github:adagio/javaAdapterDP](https://github.com/adagio/javaAdapterDP)

## Other examples

- [Introducing iOS Design Patterns in Swift: Part 2, at raywenderlich.com](https://www.raywenderlich.com/90773/introducing-ios-design-patterns-in-swift-part-2)
- [Design Patterns in Swift: Adapter by @kingreza](https://shirazian.wordpress.com/2016/05/24/design-patterns-in-swift-adapter/)
- [Adapter pattern in Swift, at jeremy-codes](https://medium.com/jeremy-codes/adapter-pattern-in-swift-7332e178f112)