Swiftpack.co - MartinMetselaar/vragen-sdk as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by MartinMetselaar.
MartinMetselaar/vragen-sdk 1.0.0
iOS SDK of Vragen. A way to survey your users while staying owner of the data.
⭐️ 2
🕓 3 years ago
iOS
.package(url: "https://github.com/MartinMetselaar/vragen-sdk.git", from: "1.0.0")

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.

GitHub

link
Stars: 2
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

Ask around
3 years ago

Releasing a visual interface to display users a survey

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics