yyb

YYBottomSheet

Simple and Clear BottomSheet

Showing:

Popularity

Downloads/wk

0

GitHub Stars

46

Maintenance

Last Commit

1yr ago

Contributors

3

Package

Dependencies

0

License

MIT

Categories

Readme

YYBottomSheet

Swift Version SwiftPM License Platform

Introduction

When you need to let users choose one of several or know informations by showing bottomSheet, you can use YYBottomSheet. Simple And Clear 😎

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage

To create and show a bottomSheet, first of all, import the module at the beginning of the file:

import YYBottomSheet

First of all, you can show the bottomUpTable as below:

let bottomUpTable = YYBottomSheet.init(bottomUpTableTitle: title, dataArray: dataArray, options: nil) { cell in
    // whatever you want to code
    // print("\(cell.indexPath.row) : \(cell.titleLabel.text)")
}

bottomUpTable.show()

And button handler (SelectHandler) is just a lambda:

(YYBottomSheetCell) -> ()

Second, you can show the simpleToast as below:

let message = "Hello World!"
let simpleToast = YYBottomSheet.init(simpleToastMessage: message, options: nil)

simpleToast.show()

You can customize several things by setting options as below:

BottomUpTableOptions

optionexample
allowTouchOutsideToDismissfalse
backgroundAlpha0.3
tableViewHeight200
tableRowHeight50
tableViewCellLabelTextColorUIColor.blue
tableViewSeperatorStyleUITableViewCell.SeparatorStyle.none
tableViewBackgroundColorUIColor.white
headerViewBackgroundColorUIColor.yellow
headerViewTitleLabelTextColorUIColor.red

SimpleToastOptions

optionexample
showDuration2.0
backgroundColorUIColor.black
beginningAlpha0.8
messageFontUIFont.italicSystemFont(ofSize: 15)
messageColorUIColor.white

Check full example as below:

/**
* BottomUpTable
*/
let title = "Fruits"
let dataArray = ["apple", "grape", "watermelon", "banana", "strawberry", "cherry", "pineapple", "pear"]
let options: [YYBottomSheet.BottomUpTableOptions:Any] = [
    .allowTouchOutsideToDismiss: true,
    .backgroundAlpha: 0.5,
    .tableViewHeight: 200,
    .tableRowHeight: 50,
    .tableViewSeperatorStyle: UITableViewCell.SeparatorStyle.none
]

let bottomUpTable = YYBottomSheet.init(bottomUpTableTitle: title, dataArray: dataArray, options: options) { cell in
    self.selectedFruitLabel.text = cell.titleLabel.text
}

bottomUpTable.show()

/**
* SimpleToast
*/
let options: [YYBottomSheet.SimpleToastOptions:Any] = [
    .showDuration: 2.0,
    .backgroundColor: UIColor.black,
    .beginningAlpha: 0.8,
    .messageFont: UIFont.italicSystemFont(ofSize: 15),
    .messageColor: UIColor.white
]

let message = "SimpleToast can be customized!"
let simpleToast = YYBottomSheet.init(simpleToastMessage: message, options: options)

simpleToast.show()

Installation

YYBottomSheet is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'YYBottomSheet'

Author

DevYeom, dev.yeom@gmail.com

License

YYBottomSheet is available under the MIT license. See the LICENSE file for more info.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100