ARPicker
Requirements
- iOS 9.0
- Xcode 11.2
- Swift 5
Installation
ARPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'ARPicker'
Then, run the following command:
pod install
Usage
Import
import ARPicker
Initialization
Then Go to your viewController and to show picker as following:
let countryList :[String] = ["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba"]
self.showPickerView(options: countryList, selectedOption: "Andorra", doneTitleText: "Done",cancelTitleText: "Cancel",didSelectDate: { (selectedValue, selectedIndex) in
print("Selected value: \(selectedValue)")
print("Selected Index: \(selectedIndex)")
self.selectedValueLabel.text = selectedValue
self.selectedIndexLabel.text = "\(selectedIndex + 1)"
})
Explanation of different parameters
- set value of
selectedOption
to highlight the option at start. - set value of
doneTitleText
to change done button title. - set value of
cancelTitleText
to change cancel button title. - set completion block
didSelectDate
, called whenDone
button is touched.
Author
AbdulRehman Warraich, [email protected]
License
ARPicker is released under the MIT license. See LICENSE for details.