DEV Community

Cover image for Swift: Associated types.
Sergey Leschev
Sergey Leschev

Posted on • Updated on

Swift: Associated types.

Associated types in Swift work closely together with protocols. You can literally see them as an associated type of a protocol: they are family from the moment you put them together.

It's a bit more complicated to explain how associated types work but once you get the hang of it, you'll be using them more often. Protocols allow us to define a common interface between types

Declaration
Example
Contraints
Conforming a protocol to a protocol

Associated Types in Swift are a powerful way to define code that can be reused among multiple different types. Practice is required to get the most out of it but once you understand the principle you can easily reuse a lot of code.


Contacts
I have a clear focus on time-to-market and don't prioritize technical debt. And I took part in the Pre-Sale/RFX activity as a System Architect, assessment efforts for Mobile (iOS-Swift, Android-Kotlin), Frontend (React-TypeScript) and Backend (NodeJS-.NET-PHP-Kafka-SQL-NoSQL). And I also formed the work of Pre-Sale as a CTO from Opportunity to Proposal via knowledge transfer to Successful Delivery.

🛩ī¸ #startups #management #cto #swift #typescript #database
📧 Email: sergey.leschev@gmail.com
👋 LinkedIn: https://linkedin.com/in/sergeyleschev/
👋 LeetCode: https://leetcode.com/sergeyleschev/
👋 Twitter: https://twitter.com/sergeyleschev
👋 Github: https://github.com/sergeyleschev
🌎 Website: https://sergeyleschev.github.io
🌎 Reddit: https://reddit.com/user/sergeyleschev
🌎 Quora: https://quora.com/sergey-leschev
🌎 Medium: https://medium.com/@sergeyleschev
🖨ī¸ PDF Design Patterns: Download

Latest comments (0)