MGSelector 0.4.3

MGSelector 0.4.3

Maintained by [Meng Li].




MGSelector

Swift 5.0 CI Status Version License Platform

MGSelector is a customised table selector for iOS.

Example

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

Installation

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

pod 'MGSelector'

Documentation

Prepare your model which confirms the MGSelectorModel protocol at first.

struct Option: MGSelectorOption {
    var title: String
    var detail: String?
}

Confirm the MGSelectable protocol in your view controller, and invokes the openSelector method.

let options: [Options] = ...

class ViewController: UIViewController, MGSelectable {
    //...

    @IBAction func open(_ sender: UIButton) {
        openSelector(title: "Title", options: options, theme: .dark)
    }
    
    func didSelect(option: MGSelectorOption) {
        title = option.title
    }
}

Get the select result using the didSelect protocol method.

Author

lm2343635, [email protected]

License

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