Skip to content

iOS SDK of Vragen. A way to survey your users while staying owner of the data.

Notifications You must be signed in to change notification settings

MartinMetselaar/vragen-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vragen SDK

The easiest way to ask your users a few questions.

Example screenshot of a question

Installation

Swift Package Manager

Add the following as a dependency to your Package.swift.

.package(url: "https://github.com/MartinMetselaar/vragen-sdk.git", from: "1.0.0"),

Usage

The vragen-api contains a way to retrieve a survey and submit answers.

Setup

We first need to let the SDK know what the server of your vragen-api is and the token. This could for example be done in the application(_:didFinishLaunchingWithOptions:) or scene(_:willConnectTo:options:).

let server = URL(string: "https://vragenapi.example.org")!
let token = "customer-token-from-your-server"

VragenSDK.set(server: server, token: token)

NOTE: This token should be the CONSUMER_TOKEN. You should not publish (by using) your ADMIN_TOKEN because people could use it to edit and download your data.

The next step is to present the SurveyViewController which displays the survey.

let surveyId = UUID(uuidString: "your-uuid-survey-identifier")!
let userId = "user19302"
let controller = SurveyViewController(identifier: surveyId, userId: userId)
present(controller, animated: true, completion: nil)

NOTE: The userId parameter in SurveyViewController is optional. If you provide the userId you can connect multiple surveys from the same user together. If you only care about the answers and want the users to stay anonymous a nil provided userId will generate a new UUID for every time the user will answer a survey. Even when it is done twice.

You are done.

Custom interface

Want to create your own visual interface? You can use the vragen-sdk-network to implement your own interface.

About

iOS SDK of Vragen. A way to survey your users while staying owner of the data.

Resources

Stars

Watchers

Forks

Languages