Adapter Pattern in Swift for Beginners

Image by Jono Dry on Jono Dry Art
Adapter Pattern Class Diagram

When do we use it?

US to EU outlet adapter (converter)

Implementation

ThirdPartyAuthenticator
AuthenticationServiceProtocol
ThirdPartyAuthenticatorAdapter
LoginViewController

Moment of truth, let's test it out

Example
Login successful.
Email: kimyon@catmail.com
Token: 64236324.375928.23934324

Be careful when…

--

--

--

Software Engineer. Mostly iOS.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

iOS Development on VSCode

Swift — Accept only numbers on UITextField

Why do I stream my app development?

Hackathon Experience — SwiftUI Jam

Build Your First MacOS App

SwiftUI | How to turn off or change camera shutter sound

Software Design Patterns: Factories Are Not Builders

VIPER architecture and RxSwift for a cleaner iOS codebase

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
activesludge

activesludge

Software Engineer. Mostly iOS.

More from Medium

Transition images to full screen animated (iOS)

What is an API and how do I use it in Swift?

Mutating Functions In Swift

Re-thinking iOS Coordinators to Build Scalable Apps