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