//
//  GifvAttachmentViewController.swift
//  Tusker
//
//  Created by Shadowfacts on 5/12/20.
//  Copyright © 2020 Shadowfacts. All rights reserved.
//

import UIKit
import Pachyderm
import AVFoundation

class GifvAttachmentViewController: UIViewController {

    private let attachment: Attachment
    
    init(attachment: Attachment) {
        precondition(attachment.kind == .gifv)
        self.attachment = attachment
        
        super.init(nibName: nil, bundle: nil)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func loadView() {
        let asset = AVURLAsset(url: attachment.url)
        self.view = GifvAttachmentView(asset: asset, gravity: .resizeAspect)
    }

}
