feature-flags-ios
Original:🇺🇸 English
Translated
PostHog feature flags for iOS applications
1installs
Sourceposthog/skills
Added on
NPX Install
npx skill4agent add posthog/skills feature-flags-iosTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →PostHog feature flags for iOS
This skill helps you add PostHog feature flags to iOS applications.
Reference files
- - Ios feature flags installation - docs
references/ios.md - - Adding feature flag code - docs
references/adding-feature-flag-code.md - - Feature flag best practices - docs
references/best-practices.md
Consult the documentation for API details and framework-specific patterns.
Key principles
- Environment variables: Always use environment variables for PostHog keys. Never hardcode them.
- Minimal changes: Add feature flag code alongside existing logic. Don't replace or restructure existing code.
- Boolean flags first: Default to boolean flag checks unless the user specifically asks for multivariate flags.
- Server-side when possible: Prefer server-side flag evaluation to avoid UI flicker.
PostHog MCP tools
Check if a PostHog MCP server is connected. If available, look for tools related to feature flag management (creating, listing, updating, deleting flags). Use these tools to manage flags directly in PostHog rather than requiring the user to do it manually in the dashboard.
Framework guidelines
- Read configuration from environment variables via a enum with a
PostHogEnvcomputed property that callsvalueandProcessInfo.processInfo.environment[rawValue]s if missing — cases should befatalErrorandprojectToken = "POSTHOG_PROJECT_TOKEN", set in the Xcode scheme's Run environment variableshost = "POSTHOG_HOST" - When adding SPM dependencies to project.pbxproj, create three distinct objects with unique UUIDs — a (with
PBXBuildFile), anproductRef(withXCSwiftPackageProductDependencyandpackage), and anproductName(withXCRemoteSwiftPackageReferenceandrepositoryURL). The build file goes in the Frameworks phaserequirement, the product dependency goes in the target'sfiles, and the package reference goes in the project'spackageProductDependencies.packageReferences - Check the latest release version of posthog-ios at before setting the
https://github.com/PostHog/posthog-ios/releasesin the SPM package reference — do not hardcode a stale versionminimumVersion - If the project uses App Sandbox (macOS), add to the target's build settings so PostHog can reach its servers — do NOT disable the sandbox entirely
ENABLE_OUTGOING_NETWORK_CONNECTIONS = YES