mastodon-ios/Mastodon/Protocol/ScrollViewContainer.swift

20 lines
431 B
Swift

//
// ScrollViewContainer.swift
// Mastodon
//
// Created by sxiaojian on 2021/2/7.
//
import UIKit
protocol ScrollViewContainer: UIViewController {
var scrollView: UIScrollView { get }
func scrollToTop(animated: Bool)
}
extension ScrollViewContainer {
func scrollToTop(animated: Bool) {
scrollView.scrollRectToVisible(CGRect(origin: .zero, size: CGSize(width: 1, height: 1)), animated: animated)
}
}