Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A provider for DatadogFlags in dd-sdk-ios with OpenFeature's swift-sdk

License

NotificationsYou must be signed in to change notification settings

DataDog/dd-openfeature-provider-swift

Repository files navigation

Overview

This package provides a bridge betweenOpenFeature and Datadog feature flags, allowing applications to use OpenFeature's standardized interface with Datadog's feature flagging services running under the hood.

Requirements

  • Xcode 15.0+
  • Swift 5.9+
  • iOS 14.0+ / macOS 12.0+ / watchOS 7.0+ / tvOS 14.0+

Installation

Prerequisites

  1. Install Xcode from the Mac App Store or Apple Developer portal
  2. Verify Xcode Command Line Tools are installed:
    xcode-select --install

Swift Package Manager

⚠️This package is currently in development and not yet ready for production use.

Add this package to yourPackage.swift file:

dependencies:[.package(url:"https://github.com/Datadog/dd-openfeature-provider-swift.git", from:"0.1.0")]

Checkreleases for available versions.

Requirements:

  • Datadog SDK: 3.2.0+
  • OpenFeature Swift SDK: 0.4.0

Or add it through Xcode:

  1. FileAdd Package Dependencies
  2. Enter:https://github.com/Datadog/dd-openfeature-provider-swift.git

Development

SeeDEVELOPMENT.md for detailed development setup, testing, and contribution guidelines.

Usage

Quick Start

import OpenFeatureimport DatadogOpenFeatureProviderimport DatadogCoreimport DatadogFlags// 1. Initialize Datadog SDK and enable flagsletconfig=Datadog.Configuration.builderUsing(    clientToken:"YOUR_CLIENT_TOKEN",    environment:"production").build()Datadog.initialize(with: config, trackingConsent:.granted)letflagsConfig=Flags.Configuration()Flags.enable(with: flagsConfig)// 2. Create user context for targetingletcontext=ImmutableContext(targetingKey:"user123")// 3. Create and register the OpenFeature providerletprovider=DatadogProvider()awaitOpenFeatureAPI.shared.setProviderAndWait(provider: provider, initialContext: context)// 4. Get OpenFeature client and evaluate flagsletclient=OpenFeatureAPI.shared.getClient()letflagValue= client.getBooleanValue(key:"my-feature-flag", defaultValue:false)

Update With Additional Context Attributes

// Create detailed user context for advanced targetingletnewContext=ImmutableContext(    targetingKey:"user123",    structure:ImmutableStructure(attributes:["segment":Value.string("premium"),"beta_user":Value.boolean(true),"region":Value.string("us-west")]))awaitOpenFeatureAPI.shared.setEvaluationContextAndWait(evaluationContext: newContext)// Flag evaluations will now use the new contextletclient=OpenFeatureAPI.shared.getClient()letflagValue= client.getBooleanValue(key:"my-feature-flag", defaultValue:false)

Architecture

┌─────────────────┐    ┌──────────────────┐│ Your App        │────│ OpenFeature SDK  ││                 │    │                  ││ - App code      │    │ - Client API     ││ - Flag requests │    │ - Provider mgmt  ││ - Context mgmt  │    │ - Type system    │└─────────────────┘    │ - Hook system    │                       └──────────────────┘                                  │                                  ▼                       ┌──────────────────┐                       │ DatadogProvider  │                       │                  │                       │ - Creates &      │                       │   delegates to   │                       │   FlagsClient    │                       │ - Context conv.  │                       │ - Type mapping   │                       └──────────────────┘                                  │                                  ▼                       ┌──────────────────┐    ┌──────────────────┐                       │ DatadogFlags     │────│ Datadog Backend  │                       │ SDK Client       │    │                  │                       │ (dd-sdk-ios)     │    │ - Flag configs   │                       │                  │    │ - User targeting │                       │ - HTTP requests  │    │ - A/B testing    │                       │ - Caching        │    └──────────────────┘                       │ - Networking     │                       └──────────────────┘

Key Components

  • Your App: Your application using OpenFeature's standard API
  • OpenFeature SDK: The core OpenFeature Swift SDK that provides the client API, provider management, type system, and hook system
  • DatadogProvider: A bridge that creates a DatadogFlags client, converts between OpenFeature and Datadog types, and delegates flag operations to the client
  • DatadogFlags SDK Client: The client from dd-sdk-ios that communicates with Datadog's backend (created automatically by the provider)
  • Datadog Backend: Datadog's service that serves flag configurations and handles targeting

Contributing

We welcome contributions! Please seeCONTRIBUTING.md for contribution guidelines andDEVELOPMENT.md for detailed setup instructions, testing guidelines, and development workflow.

License

This project is licensed under the Apache License 2.0 - see theLICENSE file for details.

About

A provider for DatadogFlags in dd-sdk-ios with OpenFeature's swift-sdk

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp