mastodon-ios/Mastodon/Protocol/ScrollViewContainer.swift

20 lines
433 B
Swift
Raw Normal View History

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