Adds Swift `Identifiable` conformance to `ResourceObject`
Pre-release
Pre-release
In order to reduce the burden of conflict on users of the library, JSONAPI.Identifiable has been renamed to JSONAPIIdentifiable and (for all platforms that support it) conformance to Swift.Identifiable has been added to ResourceObject.
Sorry to introduce a breaking change during the release candidates. Conformance to Swift.Identifiable is really beneficial, especially if you ever pull a model into SwiftUI.
- Renamed
Identifiable->JSONAPIIdentifiable - Renamed
JSONAPIIdentifiable'sIdentifierassociated type toIDto match that of the SwiftIdentifiabletype. RemovedResourceObject.Id(i.e. consolidated so that the same type alias as is used byJSONAPIIdentifiableandSwift.Identifiableis just namedResourceObject.ID). Otherwise there is a confusing co-existence of bothResourceObject.IDandResourceObject.Id.- [EDIT] As of the soon-to-be-released 4.0.0-rc.3.2, I will have re-introduced
ResourceObject.Idwhich means thatResourceObject.IDandResourceObject.Idwill be equally valid. Not crazy about it, but no easy and satisfactory way to deal with it before the release of 4.0.0.
Suggested approach to updating code:
- Anywhere you are using
JSONAPI.Identifiable, findJSONAPI.IdentifiableorIdentifiable(careful not to pick up on SwiftIdentifiablein your codebase) and replace withJSONAPIIdentifiable. - Anywhere you are using
Identifier()orin the context of aId()ResourceObjectto construct its ID, replace withID(). [EDIT] As of 4.0.0-rc.3.2ResourceObject.IDandResourceObject.Idwill both be equally valid.