Add Swift Identifiable conformance#70
Merged
mattpolzin merged 2 commits intomastermattpolzin/JSONAPI:masterfrom May 29, 2020
feature/swift-identifiablemattpolzin/JSONAPI:feature/swift-identifiableCopy head branch name to clipboard
Merged
Add Swift Identifiable conformance#70mattpolzin merged 2 commits intomastermattpolzin/JSONAPI:masterfrom feature/swift-identifiablemattpolzin/JSONAPI:feature/swift-identifiableCopy head branch name to clipboard
mattpolzin merged 2 commits intomastermattpolzin/JSONAPI:masterfrom
feature/swift-identifiablemattpolzin/JSONAPI:feature/swift-identifiableCopy head branch name to clipboard
Conversation
… conformance to the same types
…pealias for a ResourceObject identifying type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In order to reduce the burden of conflict on users of the library,
JSONAPI.Identifiablehas been renamed toJSONAPIIdentifiableand (for all platforms that support it) conformance toSwift.Identifiablehas been added toResourceObject.Sorry to introduce a breaking change during the release candidates. Conformance to
Swift.Identifiableis really beneficial, especially if you ever pull a model into SwiftUI. This change also reduces the confusingResourceObject.Id/ResourceObject.Identifiersituation down to just a singleResourceObject.ID.Identifiable->JSONAPIIdentifiableJSONAPIIdentifiable'sIdentifierassociated type toIDto match that of the SwiftIdentifiabletype.ResourceObject.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.Suggested approach to updating code:
JSONAPI.Identifiable, findJSONAPI.IdentifiableorIdentifiable(careful not to pick up on SwiftIdentifiablein your codebase) and replace withJSONAPIIdentifiable.Identifier()orId()in the context of aResourceObjectto construct its ID, replace withID().