Skip to content

Commit 599e5eb

Browse files
committed
2 parents 75b51e8 + 3e5b29d commit 599e5eb

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# PullUpController
2+
Create your own pull up controller with multiple sticky points like in iOS Maps
3+
4+
[![Platform](http://img.shields.io/badge/platform-ios-red.svg?style=flat
5+
)](https://developer.apple.com/iphone/index.action)
6+
[![Swift 4](https://img.shields.io/badge/Swift-4-orange.svg?style=flat)](https://developer.apple.com/swift/)
7+
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/PullUpController.svg)](https://img.shields.io/cocoapods/v/PullUpController.svg)
8+
9+
<img src="demo.gif" height="500"/>
10+
11+
# Setup
12+
1. Add ```pod 'PullUpController'``` to your Podfile or copy "PullUpController.swift" into your project
13+
2. Make sure the view controller that will be your pull up controller must inherit from ```PullUpController```
14+
3. Add the controller as child of your main controller using ```addPullUpController(<#T##pullUpController: PullUpController##PullUpController#>)```
15+
16+
# Customization
17+
You can customize the controller behavior by overriding the followings properties:
18+
19+
```pullUpControllerPreviewOffset: CGFloat```
20+
>The desired height in screen units expressed in the pull up controller coordinate system that will be initially showed.
21+
>The default value is ```50```
22+
23+
```pullUpControllerPreferredSize: CGSize```
24+
>The desired size of the pull up controller’s view, in screen units.
25+
>The default value is width: ```UIScreen.main.bounds.width, height: 400```.
26+
27+
```pullUpControllerMiddleStickyPoints: [CGFloat]```
28+
>A list of y values, in screen units expressed in the pull up controller coordinate system.
29+
>At the end of the gestures the pull up controller will scroll to the nearest point in the list.
30+
>
31+
>Please keep in mind that this array should contains only sticky points in the middle of the pull up controller's view;
32+
>There is therefore no need to add the fist one (```pullUpControllerPreviewOffset```), and/or the last one (```pullUpControllerPreferredSize.height```).
33+
>
34+
>For a complete list of all the sticky points you can use ```pullUpControllerAllStickyPoints```
35+
36+
```pullUpControllerAllStickyPoints: [CGFloat]```
37+
>A list of y values, in screen units expressed in the pull up controller coordinate system.
38+
>At the end of the gesture the pull up controller will scroll at the nearest point in the list.
39+
40+
```pullUpControllerIsBouncingEnabled: Bool```
41+
>A Boolean value that determines whether bouncing occurs when scrolling reaches the end of the pull up controller's view size.
42+
>The default value is ```false```.
43+
44+
```pullUpControllerPreferredLandscapeFrame: CGRect```
45+
>The desired size of the pull up controller’s view, in screen units when the device is in landscape mode.
46+
>The default value is ```(x: 10, y: 10, width: 300, height: UIScreen.main.bounds.height - 20)```.
47+
48+
It's all possible to manually change the view controller's view position by using the method
49+
```pullUpControllerMoveToVisiblePoint(_ visiblePoint: CGFloat, completion: (() -> Void)?)```
50+
51+
>This method will move the pull up controller's view in order to show the provided visible point.
52+
>
53+
>You may use on of `pullUpControllerAllStickyPoints` item to provide a valid visible point.
54+
>- `visiblePoint`: the y value to make visible, in screen units expressed in the pull up controller coordinate system.
55+
>- `completion`: The closure to execute after the animation is completed. This block has no return value and takes no parameters. You may specify nil for this parameter.
56+
57+
# Demo
58+
In this repository you can also find a demo.
59+
60+
# Info
61+
If you like this git you can follow me here or on twitter :) [@MarioIannotta](http://www.twitter.com/marioiannotta)
62+
63+
Cheers from Italy!

0 commit comments

Comments
 (0)