https://github.com/prolificinteractive/velar
A custom alert view presenter.
https://github.com/prolificinteractive/velar
alert card custom presenter
Last synced: 8 months ago
JSON representation
A custom alert view presenter.
- Host: GitHub
- URL: https://github.com/prolificinteractive/velar
- Owner: prolificinteractive
- License: mit
- Created: 2018-04-27T12:54:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-07-31T20:51:32.000Z (over 7 years ago)
- Last Synced: 2025-04-29T13:05:11.495Z (8 months ago)
- Topics: alert, card, custom, presenter
- Language: Swift
- Size: 5.01 MB
- Stars: 6
- Watchers: 13
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://travis-ci.org/prolificinteractive/Velar)
[](https://img.shields.io/cocoapods/v/Velar.svg)
[](http://cocoadocs.org/docsets/Velar)
[](http://cocoadocs.org/docsets/Velar)
## Description
Velar can present a custom view with a swipeable dismiss gesture.

## Requirements
* iOS 8.0+
## Installation
### CocoaPods
Velar is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod 'Velar'
```
## Usage
### Create the Designer
```
final class DefaultBackgroundOverlayDesigner: BackgroundOverlayDesignable {
var dismissLabelText: String {
return "Release to Dismiss!"
}
var hideDismissLabel: Bool {
return false
}
var dismissLabelColor: UIColor {
return UIColor.white
}
var backgroundColor: UIColor {
return UIColor.black.withAlphaComponent(0.4)
}
}
```
### Build the Modal View Presenter
```
private lazy var velarPresenter: VelarPresenter = {
return VelarPresenterBuilder.build(designer: DefaultBackgroundOverlayDesigner())
}()
```
### Show the Alert
```
velarPresenter.show(view: imagePopOverView, animate: true)
```
### Hide the Alert
```
velarPresenter.hide(animate: true)
```
### Presenter Delegate
The `VelarPresenter` has a delegate that can be used to know when the presenter is going to present or dismiss.
```
public protocol VelarPresenterDelegate {
/// Notifies delegate that velar presenter will present.
func willPresent()
/// Notifies delegate that velar presenter will dismiss.
func willDismiss()
/// Notifies delegate that velar presenter did present.
func didPresent()
/// Notifies delegate that velar presenter did dismiss.
func didDismiss()
}
```
Simply set the delegate of the `VelarPresenter` to handle these updates.
`velarPresenter.delegate = self`
## Contributing to Velar
To report a bug or enhancement request, feel free to file an issue under the respective heading.
If you wish to contribute to the project, fork this repo and submit a pull request. Code contributions should follow the standards specified in the [Prolific Swift Style Guide](https://github.com/prolificinteractive/swift-style-guide).
## License

Copyright (c) 2017 Prolific Interactive
Velar is maintained and sponsored by Prolific Interactive. It may be redistributed under the terms specified in the [LICENSE] file.
[LICENSE]: ./LICENSE