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 parentview controller. The survey is displayed in full screen mode.
Parameters are :-
parent: The
UIViewControllerthat will present the survey modally.delegate: An object conforming to the
XeboSurveyDelegateprotocol 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
UIViewControllerthat will present the survey.delegate: An object conforming to the
Xebo Survey Delegateprotocol 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)Loads Lowest Response Survey
This function calls an external API to find which survey from a list of UUIDs has the lowest response count and loads it.
Parameters are:-
from: A list of survey UUIDs to check.apiKey: Your Xebo API Key for authentication.parent: The UIViewController that will present the survey.delegate: An object conforming to XeboSurveyDelegate.
let myUUIDs = ["uuid-1", "uuid-2,...."]
let myKey = "bdcdaf1b18ed49069ebfc7b1654a078a97218b2847851f6b11d067afd45a50ec"Example Usage:
xsSurveyView.loadLowestResponseSurvey(
from: myUUIDs,
apiKey: myKey,
parent: self,
delegate: self
)6. Pre-warm Survey
Initializes the survey engine early to eliminate startup delays. Call this in your AppDelegate.
XeboSurveyView.preWarmSurvey()
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.