2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

24 lines
542 B
Swift

//
// Attachment.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021-2-23.
//
import Foundation
import CoreDataStack
import MastodonSDK
extension Attachment {
var type: Mastodon.Entity.Attachment.AttachmentType {
return Mastodon.Entity.Attachment.AttachmentType(rawValue: typeRaw) ?? ._other(typeRaw)
}
var meta: Mastodon.Entity.Attachment.Meta? {
let decoder = JSONDecoder()
return metaData.flatMap { try? decoder.decode(Mastodon.Entity.Attachment.Meta.self, from: $0) }
}
}