1. Create a Survey Object
@IBOutlet weak var surveyView: XeboSurveyView!
2. Loads Full Screen Survey
This function initializes a XeboSurveyViewController
, assigns the survey URL and delegate, and then presents the survey modally on the parent
view controller. The survey is displayed in full screen mode.
Parameters are :-
parent: The
UIViewController
that will present the survey modally.delegate: An object conforming to the
XeboSurveyDelegate
protocol that will
handle survey-related events. 3. surveyURL: An optional string containing the URL of the survey. If nil
, it will still
attempt to load the survey without a URL .
func loadFullscreenSurvey(parent: UIViewController, delegate: XeboSurveyDelegate, surveyURL: String? = nil) {}
Example Usage:-
self.surveyView.loadFullscreenSurvey(parent: self, delegate: self, surveyURL: survey_URL)
Above is being execute against instance of the UIViewController
3. Load survey after N visits
This function checks the number of times a user has visited a particular part of the app (associated with a specific surveyURL
). It uses User Defaults
to track the number of visits. If the number of visits matches the specified visits
,
it will trigger the loading of the full screen survey. Otherwise, it increments the visit
count in User Defaults
.
Parameters are :-
visits: Then umber of visits after which the survey should be triggered.
parent: The
UIViewController
that will present the survey.delegate: An object conforming to the
Xebo Survey Delegate
protocol that will
handle survey-related events. 4. surveyURL: An optional string containing the survey URL. If nil
, the function will
exit early without loading the survey.
xsSurveyView.loadSurveyAfter(numberOfVisits: N, parent: self, delegate: self, surveyURL: survey_URL)
Example Usage:
xsSurveyView.loadSurveyAfter(numberOfVisits: 2, parent: self, delegate: self, surveyURL: tech_survey)
In above, number of visits is 2 and the survey will load after that means when user visits for 3rd time it’ll show a survey.
Embedded Survey
This function loads a survey within the current view context, making it embedded rather than full screen. It also ensures that the close button for the survey is visible to allow users to exit the embedded survey.
Parameters are:-
surveyURL: An optional string containing the URL of the survey. If
nil
, it will still
attempt to load the survey without a URL.
xsSurveyView.loadEmbedSurvey (_ surveyURL: String? = nil) {}
Example Usage:
xsSurveyView.loadEmbedSurvey(survey_URL)
In above, the xsSurveyView can be any sub view or internal view in which you want to load the survey. By this you can show survey in certain part of the screen or in a popup window.