Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/KyleGoddard/KGFloatingDrawer
A floating navigation drawer with an interesting animated presentation written in Swift.
https://github.com/KyleGoddard/KGFloatingDrawer
Last synced: 26 days ago
JSON representation
A floating navigation drawer with an interesting animated presentation written in Swift.
- Host: GitHub
- URL: https://github.com/KyleGoddard/KGFloatingDrawer
- Owner: KyleGoddard
- License: mit
- Created: 2015-03-01T20:30:10.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2019-08-28T00:31:51.000Z (over 5 years ago)
- Last Synced: 2024-10-21T04:09:56.521Z (about 2 months ago)
- Language: Swift
- Size: 7.97 MB
- Stars: 499
- Watchers: 20
- Forks: 79
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cocoa - KGFloatingDrawer
- awesome - KGFloatingDrawer - A floating navigation drawer with an interesting animated presentation written in Swift. (OOM-Leaks-Crash / Side Drawer)
README
# KGFloatingDrawer
KGFloatingDrawer is a reimplementation of
[JVillella/JVFloatingDrawer](https://github.com/JVillella/JVFloatingDrawer) in
Swift. A floating drawer style navigation. KGFloatingDrawer provides a unique
twist on the nav drawer pattern.![](https://github.com/KyleGoddard/KGFloatingDrawer/blob/master/kgfloatingdrawer_github_preview.gif)
#Update
Currently working on updating this for Swift 3 and to take care of some of the reported issues.
#Usage
```swift
func prepareDrawerViewController() -> KGDrawerViewController {
let drawerViewController = KGDrawerViewController()drawerViewController.centerViewController = drawerSettingsViewController()
drawerViewController.leftViewController = leftViewController()
drawerViewController.rightViewController = rightViewController()
drawerViewController.backgroundImage = UIImage(named: "sky3")_drawerViewController = drawerViewController
return drawerViewController
}
```#Installation
KGFloatingDrawer can be installed as a CocoaPod. To install it, simply add the following line to your Podfile:
```
pod 'KGFloatingDrawer', '~> 0.2.0'
```###Important Note
KGFloatingDrawer requires `Swift 2.0`, `Xcode 7.0` and `CocoaPods 0.36.0`
#How it Works
###KGDrawerViewController
The `KGDrawerViewController` maintains references to center, left and optionally
right view controllers. The `centerViewController`, `leftViewController` and
`rightViewController` properties can all be reassigned in order to replace them.###Opening & Closing Drawers
`KGDrawerViewController` has three functions used to open and close the nav
drawer.```swift
func openDrawer(side: KGDrawerSide, animated:Bool, complete: (finished: Bool) -> Void) {}func closeDrawer(side: KGDrawerSide, animated: Bool, complete: (finished: Bool) -> Void) {}
func toggleDrawer(side: KGDrawerSide, animated: Bool, complete: (finished: Bool) -> Void) {}
```###Drawer Width
The `leftDrawerWidth` and `rightDrawerWidth` are used to set the width of the
drawer once it has been opened. Note that this is not the edge size of the
`centerViewController`. The default value for this is `280` points.###Background Image
The background image displayed when the drawer is open is set via the
`backgroundImage` property.###Animator
`KGFloatingDrawer` comes with a spring animator with the configurable
properties: `animationDelay`, `animationDuration`, `initialSpringVelocity`, and
`springDamping`But [JVillella/JVFloatingDrawer](https://github.com/JVillella/JVFloatingDrawer)
has custom animators!?I know! The ability to set a custom animator is coming soon.
#Author
Kyle Goddard
[JVillella/JVFloatingDrawer](https://github.com/JVillella/JVFloatingDrawer) was
authored by Julian Villella#License
KGFloatingDrawer is available under the MIT license. See the LICENSE file for
more info.