mastodon-app-ufficiale-ipho.../Mastodon/Extension/CoreDataStack/Attachment.swift

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) }
}
}