DEV Community

Swift Protocols β€” The Art of Making Promises 🀝

Gamya on August 05, 2026

Protocols let you define what a type can do without caring about what it actually is. Once that clicks, a huge chunk of Swift and SwiftUI ...
Collapse
 
publiflow profile image
PubliFlow

Solid mobile content. We built an AI tools web app (tools.shopveigo.com) that works well on mobile β€” image toolbox, headshots, resume optimizer. Used PWA approach instead of native. Would be curious to hear your take on PWA vs native for AI tools.

Collapse
 
gamya_m profile image
Gamya

Thanks for reading! The series is focused on native Swift/iOS for now so PWA comparisons are a bit outside the current scope, but an interesting topic for another time.

Collapse
 
publiflow profile image
PubliFlow

Makes total sense to keep the series focused on native Swift and iOS fundamentals first. Mastering protocols is definitely the right foundation before branching out into cross-platform web comparisons. Looking forward to seeing how native iOS handles those AI tool integrations down the line.

Thread Thread
 
gamya_m profile image
Gamya

Thanks! AI integration is definitely on the roadmap as the series gets into more advanced topics.

Thread Thread
 
publiflow profile image
PubliFlow

Abstracting machine learning model implementations behind custom protocols using CoreML sounds like a perfect fit for those advanced topics. It will be interesting to see how protocol-oriented design handles the specific constraints and data pipelines typical of AI frameworks.

Thread Thread
 
gamya_m profile image
Gamya

That's a really interesting angle I hadn't thought about specifically, using protocols to abstract CoreML model implementations so you can swap models without changing the rest of the code. It's exactly the kind of real-world use case that makes protocol-oriented design click beyond the textbook examples. Definitely something to keep in mind for when the series gets into more advanced topics.

Collapse
 
merbayerp profile image
Mustafa ERBAY

Nice explanation. One small suggestion: since modern Swift encourages explicit existentials, it might be worth updating the examples to use any Fighter instead of just Fighter. It would also be interesting to add a short note about when you’d choose any Fighter versus a generic constraint (), since that’s usually the next question readers have after learning protocols.

Collapse
 
gamya_m profile image
Gamya

Really good points, thank you! The any keyword for existentials is something I deliberately left out here to keep the introduction focused on the core concept, but you're right that it's worth flagging since the compiler will warn about bare protocol types in modern Swift. The any Fighter vs generic constraint distinction is exactly the next question, and it's a meaty enough topic to deserve its own treatment rather than a footnote. Will make sure it gets proper coverage when the series gets to generics. Appreciate the careful read as always!