Vernissage/CoreData/StatusData+Attachments.swift

20 lines
440 B
Swift
Raw Normal View History

2023-01-03 14:09:22 +01:00
//
// https://mczachurski.dev
// Copyright © 2023 Marcin Czachurski and the repository contributors.
2023-03-28 10:35:38 +02:00
// Licensed under the Apache License 2.0.
2023-01-03 14:09:22 +01:00
//
import Foundation
extension StatusData {
func attachments() -> [AttachmentData] {
2023-02-07 10:20:24 +01:00
guard let attachments = self.attachmentsRelation else {
return []
}
return attachments.sorted(by: { lhs, rhs in
lhs.order < rhs.order
2023-02-07 10:20:24 +01:00
})
2023-01-03 14:09:22 +01:00
}
}