mastodon-ios/Mastodon/Protocol/ScrollViewContainer.swift

20 lines
431 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 {
2022-05-13 11:23:35 +02:00
var scrollView: UIScrollView { get }
2021-02-07 07:42:50 +01:00
func scrollToTop(animated: Bool)
}
extension ScrollViewContainer {
func scrollToTop(animated: Bool) {
2022-05-13 11:23:35 +02:00
scrollView.scrollRectToVisible(CGRect(origin: .zero, size: CGSize(width: 1, height: 1)), animated: animated)
2021-02-07 07:42:50 +01:00
}
}