Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/muyexi/SemiModalViewController

UIViewController extension to present view / view controller as bottom-half modal.
https://github.com/muyexi/SemiModalViewController

ios swift

Last synced: 6 days ago
JSON representation

UIViewController extension to present view / view controller as bottom-half modal.

Awesome Lists containing this project

README

        

[![CocoaPods](https://img.shields.io/cocoapods/v/SemiModalViewController.svg?maxAge=2592000)](https://cocoapods.org/pods/SemiModalViewController)
[![SPM](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat)](https://swift.org/package-manager/)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/muyexi/SemiModalViewController/blob/master/LICENSE)

`UIViewController` extension to present view / view controller as bottom-half modal.



## Installation

### CocoaPods

```ruby
pod 'SemiModalViewController'
```

### Swift Package Manager

```swift
dependencies: [
.Package(url: "https://github.com/muyexi/SemiModalViewController.git", majorVersion: 0)
]
```

## Usage

Present a view controller:

```swift
let options = [
SemiModalOption.pushParentBack: true
]

let controller = UIViewController()

controller.view.height = 200
controller.view.backgroundColor = UIColor.redColor()

presentSemiViewController(controller, options: options, completion: {
print("Completed!")
}, dismissBlock: {
print("Dismissed!")
})
```

Or view:

```swift
let view = UIView(frame: UIScreen.mainScreen().bounds)
view.height = 300
view.backgroundColor = UIColor.redColor()

presentSemiView(view, options: options) {
print("Completed!")
}
```

Dismiss a presented view / view controller:

```swift
dismissSemiModalView()
```

Default options:

```swift
SemiModalOption.traverseParentHierarchy : true,
SemiModalOption.pushParentBack : false,
SemiModalOption.animationDuration : 0.5,
SemiModalOption.parentAlpha : 0.5,
SemiModalOption.parentScale : 0.8,
SemiModalOption.shadowOpacity : 0.5,
SemiModalOption.transitionStyle : .slideUp,
SemiModalOption.disableCancel : true
```

## Credits

SemiModalViewController is based on [KNSemiModalViewController](https://github.com/kentnguyen/KNSemiModalViewController).

## License

SemiModalViewController is released under the MIT license. See LICENSE for details.