New Feature in Xcode 14 – Inserting Code Automatically To Codable Types Using Auto-Completion

June 11th, 2022

⏱ Reading Time: < 1 min

We all know the Codable protocol, the combination of Encodable and Decodable. Encoding and decoding instances of types adopting it is a quite straightforward process that hides no particular difficulties.

However, when a type does not conform to Codable automatically for some reason, i.e. it contains properties of data types that do not conform to Codable or they are marked with the @Published property wrapper, then things are becoming a bit more complicated. More specifically, it’s necessary to describe the properties that we want to encode and decode in an enum that conforms to CodingKey protocol, to implement an encoding method where we explicitly encode the value of each property, and an initializer to decode them.

All that process is really not difficult, but it causes delay to our workflow. Especially in types with a big number of properties. Xcode 14 comes to remove this unwanted friction, as it can now auto-complete all that necessary code in just a few moves. As a result, we are becoming able to get finished with such tasks within seconds, and that’s a great benefit for the overall implementation process.

In the following video I’m demonstrating how all that works through a quite simple example. I hope you enjoy it!

Stay Up To Date

Subscribe to my newsletter and get notifiied instantly when I post something new on

    We respect your privacy. Unsubscribe at any time.