Direct Select
Based on Virgil Pana's Direct select's design:
Requirements
- iOS 8.0+
- Xcode 10.0+
- Swift 5.0+
Installation
Just add the DirectSelect directory to your project
Or use Cocoapods:
Usage
1 Create an instance of DSInitialView from the createInstance
method. Comply the intended delegate to DSInitialViewDelegate
, which updates which option the user selected.
A data model of type DSDataModel
has to be passed. This is here you pass the list of all options, initial option selected, various UI configurations, etc.
1.1 More details on the DSDataModel and what configurations are available:-
2 You can use an intro view to coach users on how to use DirectSelect. (See the first example of the FoodJournal Example). Just call addAndShowIntroView()
on the DSInitialView
. When you want to remove the intro call removeIntroView()
on the same DSInitialView. As per current implementation, when user long presses on an initial view, we will remove the intro view (if present) and then show the final tableview ui.
2.1 Configurations available on the intro view:
3 You can also use custom UI in the DSInitialView and in cells of the final tablview subview. Your custom subview should implement the protocol DSSubview
. As an example check giveDataModel4()
function in ViewController
class of the Example project. We use the custom UIView CustomSubview
instead of the default view. Notice the line:
Here we assign the code creating an instance of the custom UIView to customSubviewCreator
property of the dataModel
3.1 DSSubview protocol methods are as follows:-
3.2 If we want to present the final view through some button click in our custom subview call the showFinalViewAction()
of the DSDefaultCellSubviewDelegate
protocol.
Author
Swasidhant, ssprofessional33@gmail.com