CloudKitFeatureFlags

Swift

特性 (哈!)

广泛的想法和实施想法在这里:https://www.craft.do/s/VIzO95A9chLeoW

测试应用程序在这里:https://github.com/codeOfRobin/TestingCloudKitFeatureFlags (需要设置 CloudKit 容器并使用您的  开发者帐户更改签名功能)

指南

安装

通过 Swift Package Manager 添加到您的项目,包 URL:https://github.com/codeOfRobin/CloudKitFeatureFlags。由于我们仍处于早期阶段,建议使用 main 分支。

用法

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)