codeOfRobin / CloudKitFeatureFlags

A library that lets you setup feature flagging for your iOS app using CloudKit
MIT License
98 stars 1 forks source link
cloudkit feature-flags feature-toggles swift

CloudKitFeatureFlags

Swift

Features (hah!):

Broad ideas and implementation ideas here: https://www.craft.do/s/VIzO95A9chLeoW

Test application here: https://github.com/codeOfRobin/TestingCloudKitFeatureFlags (requires setting up a CloudKit container and changing the signing capabilities with your ο£Ώ Developer account)

Guide

Installation

Add to your project via Swift Package manager, package URL: https://github.com/codeOfRobin/CloudKitFeatureFlags. Since we're still early along, it's recommended to use the main branch.

Usage

let container = CKContainer(identifier: "your container goes here, please make sure it's correctly set up in the "Signing and Capabilities section in Xcode")

lazy var featureFlags = CloudKitFeatureFlagsRepository(container: container)

/// For Combine reasons
var cancellables = Set<AnyCancellable>()
featureFlags.featureEnabled(name: "some_feature_flag").sink(receiveCompletion: { (_) in }) { (value) in
  /// use `value` to change your UI imperatively, or bind the publisher directly!
  print(value)
}.store(in: &cancellables)