Skip to content

Repository files navigation

featurevisor-example-swift

A small command line application showing how to use the Featurevisor Swift SDK.

Learn more about Featurevisor here.

It fetches a production datafile, creates a Featurevisor instance with customer context, then evaluates a flag, a variation, feature variables, and global variables.

Requirements

Swift 6.0 or newer.

Run the example

swift package resolve
swift run featurevisor-example-swift

The application evaluates commerce_platform, checkout_experience, max_items, payment_methods, serviceEndpoints, and supportContact from this datafile:

https://featurevisor-example-cloudflare.pages.dev/production/featurevisor-sdk-v3.json

Expected output:

Commerce platform enabled: true
Checkout variation: express
Maximum checkout items: 25
Payment methods: [card, wallet]
Service endpoint: https://api.eu.example.com (timeout: 1200 ms, retries: 4)
Support contact: support-nl@example.com

Change the context in Sources/featurevisor-example-swift/main.swift to see how Featurevisor selects different rules, variations, and global variable overrides.

Checks

swift build
swift run featurevisor-example-swift

Featurevisor project

The datafile is generated by the Featurevisor Cloudflare example.

Learn more in the Featurevisor Swift SDK documentation.

About

Example Swift application using Featurevisor v2+ SDK

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages