romansorochak / ParallaxHeader

Simple way to add parallax header to UIScrollView/UITableView written in Swift.
MIT License
1.03k stars 131 forks source link

Ignore top safe area insets if needed & SPM support. #56

Open MussaCharles opened 3 years ago

MussaCharles commented 3 years ago

Ignore Safe Areas

Issue: Safe area is been used to pin contentView without taking into consideration some of other custom layouts, for example having an imageView as header covering the whole navBar including safeAreas.

This PR adds an optional flag were users can set it to true if their headers fill the whole safe area.

 /// This is to support a usecase where a parallax header is being used at the very top edge of the screen.
/// If this is set to true then the header will be pinned at the top of the scrollView. Default value is `false`
    public var ignoreTopSafeAreaInset:Bool = false

Usage: myScrollview.parallaxHeader.ignoreTopSafeAreaInset = true

Swift Package Manager (SPM)

This PR also includes SPM support without any changes to source code structure. Only a package manifest file is added which points to the right source files.

Note: The reason to include SPM support on a single PR is because I am using this branch in my project.