UIScrollView

public extension UIScrollView
  • Adds refresh control. Call finishRefresh() to stop.

    Declaration

    Swift

    func addRefreshControl(action: @escaping UIRefreshControl.Action)
  • Adds refresh control. Call finishRefresh() to stop.

    Declaration

    Swift

    func addRefreshControl(target: AnyObject?, action: Selector)
  • Stops refresh

    Declaration

    Swift

    func finishRefresh()

Insets

  • Returns adjustedContentInset on iOS >= 11 and contentInset on iOS < 11.

    Declaration

    Swift

    var fullContentInsets: UIEdgeInsets { get }
  • Set value for top contentInset and scrollIndicatorInsets

    Declaration

    Swift

    func setTopInset(_ topInset: CGFloat)
  • Set 64 for top contentInset and scrollIndicatorInsets

    Declaration

    Swift

    func setTopNavigationBarsInset()
  • Set value for bottom contentInset and scrollIndicatorInsets

    Declaration

    Swift

    func setBottomInset(_ bottomInset: CGFloat)
  • Set 49 for bottom contentInset and scrollIndicatorInsets

    Declaration

    Swift

    func setBottomTabBarInset()

Scroll

Helper Properties

  • Frame of the content.

    Declaration

    Swift

    var contentFrame: CGRect { get }
  • Scrollable frame. Equal to content size + fullContentInsets.

    Declaration

    Swift

    var scrollableFrame: CGRect { get }
  • Visible area frame. Equal to bounds.

    Declaration

    Swift

    var visibleFrame: CGRect { get }
  • Returns whether scrollable frame is more than visible frame

    Declaration

    Swift

    var isScrollable: Bool { get }

Bars Avoid

  • Sets (status bar + 44) or 0 for top content inset and disables automatic mechanisms to prevent conflict. Returns true if scroll view avoids top bars. Takes into account contentInsetAdjustmentBehavior.

    Declaration

    Swift

    @IBInspectable
    var avoidNavigationBar: Bool { get set }
  • Sets 49 or 0 for bottom inset and disables automatic mechanisms to prevent conflict. Returns true if scroll view avoids bottom bars. Takes into account contentInsetAdjustmentBehavior.

    Declaration

    Swift

    @IBInspectable
    var avoidTabBar: Bool { get set }