Add array literal expressibility for ToManyRelationship

This commit is contained in:
Mathew Polzin
2018-11-27 23:59:12 -08:00
parent fcc1796731
commit d3763ba713
3 changed files with 16 additions and 0 deletions
@@ -40,6 +40,10 @@ public struct ToManyRelationship<Relatable: JSONAPI.Relatable>: RelationshipType
public let ids: [Relatable.Identifier]
public init(ids: [Relatable.Identifier]) {
self.ids = ids
}
public init<T: JSONAPI.Relatable>(relationships: [ToOneRelationship<T>]) where T.WrappedIdentifier == Relatable.Identifier {
ids = relationships.map { $0.id }
}