SelectableView is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod"SelectableView"If you used use_framework in your podfile just simply do:
import SelectableViewfor every file when you need to use it.
you may also use:
@import SelectableView;within bridging header file and avoid to import framework for every needed file.
##Info
- entirely written in latest Swift syntax.
##Usage
Simply add SingleSelectableView, MultiSelectableView or SearchSelectableView as a subclass of your UIView in Interface Builder.
@IBOutletopenvarswitchButton:UIButton?@IBOutletopenvarcontentOptionsHeightConstraint:NSLayoutConstraint?@IBOutletopenvarcontentOptionsView:UIView?@IBOutletopenvarselectedOptionLabel:UILabel? //only SingleSelectableView
@IBOutletopenvarverticalTokenView:VerticalTokenView? //only MultiSelectableView
@IBOutletopenvarhorizontalTokenView:HorizontalTokenView? //only MultiSelectableView
@IBOutletopenvartokenViewHeightConstraint:NSLayoutConstraint? //only MultiSelectableView, useful within UIScrollView
@IBOutletopenvartextField:UITextField! //only SearchSelectableViewsingleSelectableView.delegate =self
multiSelectableView.delegate =self
searchSelectableView.delegate =self@objcpublicprotocolSelectableViewDelegate{@objcoptionalfunc multiSelectableView(_ view:MultiSelectableView, tokenViewFor option:SelectableOption)->UIView@objcoptionalfunc singleSelectableView(_ view:SingleSelectableView, didSelect option:SelectableOption)@objcoptionalfunc multiSelectableView(_ view:MultiSelectableView, didSelect option:SelectableOption)@objcoptionalfunc searchSelectableView(_ view:SearchSelectableView, didSelect option:SelectableOption)@objcoptionalfunc selectableViewDidToggleOptions(with button:UIButton, expanded:Bool)}varfontForOption=UIFont.systemFont(ofSize:16)varfontForPlaceholderText=UIFont.systemFont(ofSize:14)@IBInspectableopenvarleftPaddingForPlaceholderText=0@IBInspectableopenvarleftPaddingForOption=20@IBInspectableopenvarheightForOption=40@IBInspectableopenvartitleColorForSelectedOption=UIColor.green
@IBInspectableopenvartitleColorForOption=UIColor.black
@IBInspectableopenvartextColorForPlaceholderText=UIColor.gray
@IBInspectableopenvartintColorForSelectedOption=UIColor.blue
@IBInspectableopenvaridentifier=""@IBInspectableopenvartableViewAccessibilityIdentifier=""@IBInspectableopenvarmaxNumberOfRows=6@IBInspectableopenvarplaceholder=""openfunc hideOptions() //collapse selectable options
open func select(option:SelectableOption) //only MultiSelectableView
open func deselect(option:SelectableOption) //only MultiSelectableViewopenvaroptions:[SelectableOption]? //current list of options able to select it
openvarselectedOption:SelectableOption? //SingleSelectableView, SearchSelectableView
openvarselectedOptions=[SelectableOption]() //MultiSelectableViewopenclassSelectableOption:NSObject{openvarindex:Intopenvaridentifier:Stringopenvartitle:StringopenvaruserInfo:[AnyHashable:Any]?openvardescendantOptions=[SelectableOption]()publicinit(index:Int, title:String, identifier:String, userInfo:[AnyHashable:Any]?=nil){self.index = index
self.identifier = identifier
self.title = title
self.userInfo = userInfo
}}Bartłomiej Semańczyk, bartekss2@icloud.com
SelectableView is available under the MIT license. See the LICENSE file for more info.





