Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Add Swift Identifiable conformance#70

Merged
mattpolzin merged 2 commits intomastermattpolzin/JSONAPI:masterfrom
feature/swift-identifiablemattpolzin/JSONAPI:feature/swift-identifiableCopy head branch name to clipboard
May 29, 2020
Merged

Add Swift Identifiable conformance#70
mattpolzin merged 2 commits intomastermattpolzin/JSONAPI:masterfrom
feature/swift-identifiablemattpolzin/JSONAPI:feature/swift-identifiableCopy head branch name to clipboard

Conversation

@mattpolzin
Copy link
Owner

@mattpolzin mattpolzin commented May 29, 2020

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.

⚠️ Breaking Changes ⚠️
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. This change also reduces the confusing ResourceObject.Id/ResourceObject.Identifier situation down to just a single ResourceObject.ID.

  • Renamed Identifiable -> JSONAPIIdentifiable
  • Renamed JSONAPIIdentifiable's Identifier associated type to ID to match that of the Swift Identifiable type.
  • Removed ResourceObject.Id (i.e. consolidated so that the same type alias as is used by JSONAPIIdentifiable and Swift.Identifiable is just named ResourceObject.ID). Otherwise there is a confusing co-existence of both ResourceObject.ID and ResourceObject.Id.

Suggested approach to updating code:

  1. Anywhere you are using JSONAPI.Identifiable, find JSONAPI.Identifiable or Identifiable (careful not to pick up on Swift Identifiable in your codebase) and replace with JSONAPIIdentifiable.
  2. Anywhere you are using Identifier() or Id() in the context of a ResourceObject to construct its ID, replace with ID().

@mattpolzin mattpolzin self-assigned this May 29, 2020
…pealias for a ResourceObject identifying type.
@mattpolzin mattpolzin merged commit 8aa20f3 into master May 29, 2020
@mattpolzin mattpolzin deleted the feature/swift-identifiable branch May 29, 2020 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.