InnoSelector 1.1.45

InnoSelector 1.1.45

Maintained by Gopinath A.



  • By
  • Gopinath A

InnoSelector

Language Supports License Platform

Description

A framework for data selection which has the option for both single and multi-select functionalities. In this, you can also customise the attributes like how the view should present, what will be the title and its colour, whether the table content should have the image or not, colour for the title and subtitle of the table content, bottom theme colour and much more.

Example

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

Customisation Single-Select/Multi-Select
Push-View/PresentView Fullscreen
Navigation Drop Down Pop Over

Requirements

  • iOS 8.0+
  • Xcode 9.2

Usage

Initialization:

  1. For Bottom Sheet
let selectorFilter = InnoSelector.bottomSheet()
  1. For PopOver
// Your class should implement UIAdaptivePresentationControllerDelegate
class ViewController: UIViewController, UIAdaptivePresentationControllerDelegate{

let selectorFilter = InnoSelector.popOver()

if let whatSender = sender as? UIBarButtonItem{
selectorFilter.popoverPresentationController?.barButtonItem = whatSender
}else{
selectorFilter.popoverPresentationController?.sourceView = sender as? UIView
}
selectorFilter.preferredContentSize = CGSize(width: 300, height: 400
selectorFilter.presentationController?.delegate = self

// Delegate Methods
func adaptivePresentationStyle(for controller: UIPresentationController) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}

func adaptivePresentationStyle(for controller: UIPresentationController, traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return UIModalPresentationStyle.none
}

}
  1. For Navigation Dropdown(Supports only Single Select)
let selectorFilter = InnoSelector.navigationDropDown()

Passing Data:

For now we are supporting only [Strings] and [CustomObjects]

var data: [InnoData] = []
var data2: [InnoData] = []
var data3:[String] =  []
var data4:[String] = []
var multiselecr: Bool = true

data = [CustomDataObject(image: <#T##UIImage?#>, primaryText: <#T##String#>, subText: <#T##String?#>)]
data3 = ["Gopi", "Asmita", "Jassi", "Manoj", "Dhiraj", "Suraj"]

For [Custom Data]

selectorFilter.setContent(dataSource: data, selectedValues: data2, isMultiselect: multiselecr, minSelection: 1, maxSelection: 10)

For [String]

selectorFilter.setContent(dataSource: data3, selectedValues: data4, isMultiselect: multiselecr, minSelection: 1, maxSelection: 10)
  • Note: For Navigation Drop Down "isMultiselect" should be false.

Presenting View:

  1. For Bottom Sheet
var pushView: Bool = false

if pushView {
selectorFilter.push(viewController: self, innoSelector: selectorFilter)
}else{
selectorFilter.presentIn(viewController: self)
}
  1. For PopOver
present(selectorFilter, animated: true, completion: nil)
  1. For Navigation Dropdown
let selectorFilter = InnoSelector.navigationDropDown()
selectorFilter.present()

Completion Handler:

selectorFilter.completionHandler = { event, selectedValues in
switch event {
case .didApply:
if let selectedData = selectedValues as? [InnoData]{
self.data2 = selectedData
}else{
self.data4 = selectedValues as! [String]
}
print(selectedValues.count)
case .didCancel:
print("Cancel")
}
}

Customization

For Bottom Sheet

  1. Set FullScreen
selectorFilter.setFullScreen = true
  1. Change Layout Height
selectorFilter.selectorViewHeight = 300.0
  1. Set Title
selectorFilter.setTitle(title: "titleString", color: titleTextColor)
  1. Set Button Theme
selectorFilter.setButtonThemeColor(color: UIColor.black)
  1. Set Content Theme
selectorFilter.setContentTextColor(Title: tablePriText, subTitle: tableSubText)
  1. Hide Top Bar
selectorFilter.hideTopBar = true
  1. Set Font
selectorFilter.setTextLabelFont(name: "Avenir", size: 15)
selectorFilter.setDetailTextLabelFont(name: "Avenir", size: 15)

For PopOver

  1. Set Button Theme
selectorFilter.setButtonThemeColor(color: UIColor.black)
  1. Set Content Theme
selectorFilter.setContentTextColor(Title: tablePriText, subTitle: tableSubText)

For Navigation DropDown

  1. Set Content Theme
selectorFilter.setContentTextColor(Title: tablePriText, subTitle: tableSubText)
  1. Set Table Height
selectorFilter.tableHeight = 250

Installation

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

pod 'InnoSelector'

Author

Gopinath A, [email protected]

License

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