Hey iOS developer! 👋
Today’s topic is quite straightforward - list of some essential Swift protocols designed to improve code readability and maintainability, making them invaluable for Swift developers.
Sponsor
SwiftyLaunch – Build your next iOS app in days, not weeks.
Tired of coding the same boilerplate features over and over? Let SwiftyLaunch handle the heavy lifting. Our powerful iOS app generator creates all the essentials—paywalls, authentication flows, push notifications, and more—so you can focus on building a remarkable user experience.
Grab the limited-time lifetime plan now and start launching apps faster than ever!
Understanding Codable in Swift.Codable
is a protocol that allows the data to be easily converted between different formats, like JSON, Property Lists, or other representations, and Swift objects. Harsha Agarwal explains how to incorporate this protocol by providing examples of encoding and decoding the data to and from JSON file.
Read on Medium
Equatable conformance in Swift explained with code examples
Conforming to the Equatable
protocol allows objects to be compared with one another. You can either rely on Swift's default implementation or provide custom comparison logic. In this article, Antoine van der Lee explores the implementation of Equatable
conformance for custom types and how to make objects from third-party libraries conform to the protocol.
Read on Antoine van der Lee’s blog
Hashable in Swift: The Unsung Hero of Unique Identifiers
The Hashable
protocol allows instances to be efficiently located and compared in collections like Set
and Dictionary
by generating unique hash values. Norbert Grover explains how to extend control over the process of generating hash values.
Read on Medium
A Guide to Comparable in Swift: Simplifying Data Comparison
The Comparable
protocol allows you to compare and sort data by defining how instances of custom types should be ordered. It determines which instance comes before or after another. Here’s a quick guide with implementation examples.
Read on Medium
How do Swift’s memberwise initializers work?
Swift structs come with automatically generated initializers that accept values for each of their properties. Paul Hudson explains how they work, how to create custom initializers, and how to retain the automatically generated ones.
Read on Hacking with Swift
If you found this Curated iOS issue useful, I’d be happy if you:
Hit the Like button.
Subscribe, if you haven’t already!
Connect with me on LinkedIn.
Until next time!
Artjoms