// Sets the background shadow under container. (Default: backgroundShadowShow).
container.layout.landscapeBackgroundShadowShow = false
// Sets the new value for positions of animated movement (top, middle, bottom). (Default: positions).
container.layout.landscapePositions = ContainerPosition(top: 20, middle: 150, bottom: 70)
// Sets insets container.view (left, right). (Default: insets).
container.layout.landscapeInsets = ContainerInsets(right: 20, left: 100)
// Change settings right away
container.setLandscape(top: 30)
container.setLandscape(middle: 150)
container.setLandscape(bottom: 70)
container.setLandscape(middle: nil)
container.setLandscape(backgroundShadowShow: false)
container.setLandscape(left: 10)
container.setLandscape(right: 100)
Parameters for control footerView
// Padding-top from container.view, if headerView is added, then its + height is summed.
container.layout.footerPadding = 100
// Tracking position container.view during animated movement.
container.layout.trackingPosition = false
// Change settings right away
container.set(footerPadding: 100)
container.set(trackingPosition: false)
ContainerController Delegate
class ViewController: UIViewController, ContainerControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let container = ContainerController(addTo: self, layout: layout)
container.delegate = self
}
}
/// Reports rotation and orientation changes
func containerControllerRotation(_ containerController: ContainerController) {
...
}
/// Reports a click on the background shadow
func containerControllerShadowClick(_ containerController: ContainerController) {
...
}
/// Reports the changes current position of the container, after its use
func containerControllerMove(_ containerController: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
...
}
ContainerController
UI Component. This is a copy swipe-panel from app: https://www.apple.com/ios/maps/
Preview
ScrollView📃Delegateto self 👆HeaderViewFooterViewViewContainerLayouton initializationContainerLayoutViewCornerRadiusShadowBlurDelegateRequirements
✏️ ContainerController is written in Swift 5.0+. It can be built by Xcode 11 or later. Compatible with iOS 13.0+.
Installation
CocoaPods
ContainerControllerSwift is available through CocoaPods. To install it, simply add the following line to your Podfile:
Swift Package Manager with Xcode 11
Follow this doc.
Getting Started
Action
Move position with an animation
Adding possible custom subviews in ContainerController view
Add
ScrollViewDelegateto self 👆If you implement delegate ScrollView (TableView, CollectionView, TextView) to
self, then you need to call 4 functions in ContainerControllerAdd
HeaderViewAdd
FooterViewAdd Custom
ViewSettings ⚙️
Layout
Customize the layout with create subclass
ContainerLayouton initializationOr create object
ContainerLayoutChange settings right away
ContainerController
ViewUse a ready-made solution
ContainerViewis generated automatically when you create ContainerController Use a ready-made solution to change the radius, add shadow, and blur.Change
CornerRadiusAdd Layer
ShadowAdd Background
BlurMore details
Change positions on screen Top Middle Bottom
Customize indentations for View
Customize for landscape orientation
Parameters for control footerView
ContainerController
DelegateAuthor
motionrustam@gmail.com 📩| mrustaa JUNE 2020
License
ContainerController is available under the MIT license. See the LICENSE file for more info.