Improved compiler errors for auto-synthesized conformances in Xcode 11
Basics article available: CodableNew in Xcode 11/Swift 5.1: The compiler will now tell you why it can't auto-synthesize conformance to protocols like Encodable
and Decodable
, instead of just suggesting a manual implementation. Let’s say we have the following type, that we wish to conform to Decodable
automatically:
struct ItemMetadata: Decodable {
var date: Date
var format: ItemFormat
var category: String
}
If the ItemFormat
type used above isn’t Decodable
, then the compiler will now give us the following error:
Cannot automatically synthesize 'Decodable' because 'ItemFormat'
does not conform to Decodable.
Support Swift by Sundell by checking out this sponsor:

Emerge: Continuously monitor and reduce your app’s size. Emerge’s easy to use plugins for GitHub and fastlane will automatically scan your app’s binary and provide you with simple, actionable suggestions on how to make it smaller and, in turn, faster for your users to download. Set up a demo now!