I want to sort an Array of objects, by the properties it shares with another Array of objects
struct GeneralComposition : Decodable {
let id, formId, relationId, fixedContentTypeId, separatorId: Int
let orderBy: Int
}
struct FixedContentType: Decodable {
let name, htmlType: String
let isEditable: Int
let typeId : String
}
var fixedContentType = [FixedContentType]()
var generalComposition = [GeneralComposition]()
In GeneralComposition
I get the order the items must have, with orderBy
, and then take every item's fixedContentTypeID
, compare with the typeId
in FixedContentType
to get the order in which this content must be showed in screen.
Any idea about how can it be done?
Thanks!