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
'sIdentifier
associated type toID
to match that of the SwiftIdentifiable
type. RemovedResourceObject.Id
(i.e. consolidated so that the same type alias as is used byJSONAPIIdentifiable
andSwift.Identifiable
is just namedResourceObject.ID
). Otherwise there is a confusing co-existence of bothResourceObject.ID
andResourceObject.Id
.- [EDIT] As of the soon-to-be-released 4.0.0-rc.3.2, I will have re-introduced
ResourceObject.Id
which means thatResourceObject.ID
andResourceObject.Id
will 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.Identifiable
orIdentifiable
(careful not to pick up on SwiftIdentifiable
in your codebase) and replace withJSONAPIIdentifiable
. - Anywhere you are using
Identifier()
orin the context of aId()
ResourceObject
to construct its ID, replace withID()
. [EDIT] As of 4.0.0-rc.3.2ResourceObject.ID
andResourceObject.Id
will both be equally valid.