/EmbeddedScrollView

Embedded UIScrollView for iOS.

Primary LanguageSwiftMIT LicenseMIT

EmbeddedScrollView

Add a vertical UIScrollView into another vertical UIScrollView on iOS. It makes users feel like it's a single UIScrollView. This tool resolve the gesture conflict between thw two UIScrollViews.

How it works: Hook the scrollViewDidScroll method of a UIScrollView by SwiftHook, calculate and reset the offset of the UIScrollView.

It supports Swift and Objective-C

ezgif com-gif-maker

How to use EmbeddedScrollView

Just one line code to do it!

outerScrollView.embeddedScrollView = embeddedScrollView

The API is in an extension.

extension UIScrollView {

    @objc public var embeddedScrollView: UIScrollView?
}

How to integrate EmbeddedScrollView?

EmbeddedScrollView can be integrated by cocoapods.

pod 'EmbeddedScrollView'

Or use Swift Package Manager. SPM is supported from 1.1.0.

Requirements

  • iOS 10.0+
  • Xcode 11+
  • Swift 5.0+