Kurdtvs-Live-Kurdish-TV-Kur.../Mastodon/Scene/Transition/MediaPreview/MediaPreviewableViewControl...

25 lines
824 B
Swift
Raw Normal View History

//
// MediaPreviewableViewController.swift
// Mastodon
//
// Created by MainasuK Cirno on 2021-4-28.
//
import UIKit
protocol MediaPreviewableViewController: AnyObject {
var mediaPreviewTransitionController: MediaPreviewTransitionController { get }
func sourceFrame(transitionItem: MediaPreviewTransitionItem, index: Int) -> CGRect?
}
extension MediaPreviewableViewController {
func sourceFrame(transitionItem: MediaPreviewTransitionItem, index: Int) -> CGRect? {
switch transitionItem.source {
case .mosaic(let mosaicImageViewContainer):
guard index < mosaicImageViewContainer.imageViews.count else { return nil }
let imageView = mosaicImageViewContainer.imageViews[index]
return imageView.superview!.convert(imageView.frame, to: nil)
}
}
}