Create Decodable helper method#1143
Conversation
d1be81a to
ac213bc
Compare
cdhoffmann
left a comment
There was a problem hiding this comment.
Looks great, just a couple of things.
Can we update all of our uses of the asDictionary API to use the new namespace?
Also, i am not 100% sold on the naming. idk why but the all lowercase aep just feels off to me. That being said i am going to let the naming KING @sbenedicadb decide the fate of the name.
sbenedicadb
left a comment
There was a problem hiding this comment.
looks good pending the possible update for access control
| /// - dateDecodingStrategy: How `Date` values should be decoded. | ||
| /// Defaults to `.deferredToDate`. | ||
| /// - Returns: A fully-decoded instance of `Self`, or `nil` if decoding fails. | ||
| static func fromDictionary( |
There was a problem hiding this comment.
where all do we intend to use this? only inside of core? just asking because i noticed it's not public and wondered if that was intentional or not :)
There was a problem hiding this comment.
@timkimadobe I think this was added to be used in Live Activity code (Messaging extension)
Do you modify the access to public ?
There was a problem hiding this comment.
Yes, missed this access level thank you Steve! updating now
|
Changed the base branch to v5.5.1 |
Description
This PR creates a helper method on Decodable which converts a dictionary into an instance of that Decodable type; basically the opposite of the existing Encodable method
asDictionary()Alternative considered
Creating an
.aepnamespaced Codable helpers which help:[String: Any]and[String: Any]into Decodable instancesThe motivation for the namespace was to avoid polluting the global namespace, especially when attached to very high usage protocols like
EncodableandDecodableThe existing Encodable helper method
asDictionarywould have been marked as deprecated and the associated warning also provide a one click fix-it to migrate to the new namespaced helper:Before:
After:
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: