Glass
Glass copied to clipboard
:gem: iOS Layered Window Manager
Overview
Glass is a gesture-based, layered window manager that allows you to create interfaces similar to those found in Facebook Paper. Glass uses UIKit Dynamics in order to create beautiful, physics-based animations that allow your interfaces to feel natural.
Glass comes built-in with hooks, callbacks, and configuration options that allow you to customize your interfaces exactly to your liking. However, if something is missing don't hesitate to open an issue or even create a pull request!
See It In Action
Usage
CocoaPods
Add the following to your Podfile:
pod 'Glass'
Carthage
Add the following to your Cartfile:
github "comyarzaheri/Glass" "master"
Using Glass
Pushing a Window
import Glass
let rootViewController = UIViewController()
/// Offsetable windows can't be dragged off the screen by a user's pan gesture
/// Dismissable windows can be dragged off the screen by a pan gesture to be dismissed
WindowManager.shared.pushWindow(rootViewController, type: .Offsetable)
Controlling When Users Can Pan a Window
import Glass
let rootViewController = UIViewController()
WindowManager.shared.pushWindow(rootViewController, type: .Dismissable, style: .None,
gesturePredicate: { (rootViewController: UIViewController, type: WindowType) -> (Bool) in
// Check app state, perform magic computations, etc. here
return true
})
Requirements
- iOS 8.0 or higher
License
Glass is available under the MIT License.