2023-01-27 15:46:09 +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-27 15:46:09 +01:00
|
|
|
//
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-01-27 15:46:09 +01:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
extension [AttachmentData] {
|
|
|
|
func getHighestImage() -> AttachmentData? {
|
|
|
|
var attachment = self.first
|
|
|
|
var imgHeight = 0.0
|
|
|
|
|
|
|
|
for item in self {
|
|
|
|
let attachmentheight = Double(item.metaImageHeight)
|
|
|
|
if attachmentheight > imgHeight {
|
|
|
|
attachment = item
|
|
|
|
imgHeight = attachmentheight
|
|
|
|
}
|
|
|
|
}
|
2023-04-01 12:10:59 +02:00
|
|
|
|
2023-01-27 15:46:09 +01:00
|
|
|
return attachment
|
|
|
|
}
|
|
|
|
}
|