Swiftpack.co -  APUtils/StretchScrollView as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
APUtils/StretchScrollView
ScrollView that allows to stretch it's image
.package(url: "https://github.com/APUtils/StretchScrollView.git", from: "6.0.0")

StretchScrollView

Carthage compatible Swift Package Manager compatible Version License Platform CI Status

StretchScrollView provides functionality to enlarge title image and hide overlays when scrolling down. When scrolling up it allows to animate background of navigation bar.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

GIF animation

Installation

Carthage

If you are setting StretchScrollView class in storyboard assure module field is also StretchScrollView

Please check official guide

Cartfile:

github "APUtils/StretchScrollView" ~> 6.0

Then add both StretchScrollView and ViewState frameworks to your project. Remove APExtensionsViewState dependency if you previously had it.

CocoaPods

StretchScrollView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'StretchScrollView', '~> 6.0'

Configuration

Assign StretchScrollView class to your UIScrollView in storyboard, assure module field is also StretchScrollView:

Set needed outlets and options.

Usually content mode Aspect Fill fits well for UIImageView:

Properly setup constraints for stretchedView. There are two resize modes available: by top and height constraints and by top and sides constraints.

Example constraints setups:

For second setup if scroll view is enlarged it'll be automatically zoomed at center.

Also works when stretched view is inside UIStackView and have height constraint.

/// StretchScrollView will manage navigation bar transparency by itself.
/// You could disable this option to manage it by yourself or to disable navigation bar animations.
@IBInspectable var manageNavigationBarTransparency: Bool = true

/// In case of transparent navigation bar you may specify background color that will appear when you scroll up.
@IBInspectable var navigationBackgroundColor: UIColor = .clear

You are done! See example project for more details.

Contributions

Any contribution is more than welcome! You can contribute through pull requests and issues on GitHub.

Author

Anton Plebanovich, anton.plebanovich@gmail.com

License

StretchScrollView is available under the MIT license. See the LICENSE file for more info.

GitHub

link
Stars: 13
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Dependencies

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API