Simple and clean extension:
import UIKitextension UIScrollView { var scrolledToTop: Bool { let topEdge = 0 - contentInset.top return contentOffset.y <= topEdge } var scrolledToBottom: Bool { let bottomEdge = contentSize.height + contentInset.bottom - bounds.height return contentOffset.y >= bottomEdge }}
On GitHub: