ios-distribution-feature-flags
Skill1 starsChanged 27 days agoBSD-3-ClauseView on GitHub
Makes a SwiftUI or mixed iOS app behave differently in Debug, TestFlight and App Store builds at compile time. Use to hide unfinished features, turn the paywall off for testers or support trunk-based development. It covers distribution flags, not remote kill switches.
In this repository52 other files it gives its agents.
- academic-research-assistantSkill
- answer-sheetSkill
- app-graphicsSkill
- app-landing-pageSkill
- app-screenshotsSkill
- break-uiSkill
- consumer-app-from-behaviorSkill
- cross-language-safetySkill
- dart-tool-scriptsSkill
- decision-sweepSkill
- engineering-diarySkill
- figma-review-loopSkill
- flutter-app-size-auditSkill
- flutter-async-at-the-edgeSkill
- flutter-async-cubit-safetySkill
- flutter-bloc-clean-architectureSkill
- flutter-clean-architecture-tddSkill
- flutter-cubit-smart-cachingSkill
- flutter-error-logging-conventionsSkill
- flutter-observability-instrumentationSkill
- flutter-paywall-and-review-timingSkill
- flutter-precommit-cleanupSkill
- flutter-router-decisionSkill
- flutter-runtime-safetySkill
- flutter-shorebird-otaSkill
- flutter-stream-architectureSkill
- flutter-strict-analysisSkill
- flutter-web-first-paintSkill
- forced-pivot-15-daySkill
- gplay-consoleSkill
- launch-readinessSkill
- launch-watchSkill
- locale-expert-reviewSkill
- market-pulseSkill
- mobile-ui-referenceSkill
- moscow-prioritizationSkill
- orchestrate-agentic-engineeringSkill
- parallel-agent-inboxSkill
- paywall-conversion-flowSkill
- paywall-transparencySkill
- proactive-crash-repair-loopSkill
- promise-auditSkill
- pr-preview-shippingSkill
- ship-first-dollar-appSkill
- slim-ios-simulator-fleetSkill
- spec-sql-harnessSkill
- store-launch-mastermindSkill
- sync-contextSkill
- task-blitzSkill
- techdebtSkill
- vendor-decisionSkill
- web-interface-reviewSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Does not replace Swift architecture or SwiftUI skills.
- Very specific: line 19
Leave Debug at the Xcode template value DEBUG $(inherited).
- Very specific: line 24
If the target sets the condition list for those configurations without $(inherited), the project flags are hidden and Distribution.current …
- Very specific: line 68
Do not ship TestFlight values (requirePaywall = false) in the App Store config.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
iOS distribution feature flags
Compile-time flags per distribution. This is not Firebase Remote Config. Use Remote Config later for runtime rollout — don't grow this enum into a server.
Does not replace Swift architecture or SwiftUI skills.
Xcode
- Duplicate the Release configuration to
AppStoreandTestFlight. Point schemes at them. - Set
SWIFT_ACTIVE_COMPILATION_CONDITIONStoAPPSTORE $(inherited)/TESTFLIGHT $(inherited)for those configurations, at project or target level. Leave Debug at the Xcode template valueDEBUG $(inherited). Neither flag is set there, so the#elsebranch below resolves Debug to.debug. Plain Release also sets neither flag and resolves to.debug, so archive only withAppStoreorTestFlight.
Target-level values override project-level values.
If the target sets the condition list for those configurations without $(inherited), the project flags are hidden and Distribution.current is always .debug.
Code
public enum Distribution: Sendable {
case debug, appstore, testflight
static var current: Self {
#if APPSTORE
.appstore
#elseif TESTFLIGHT
.testflight
#else
.debug
#endif
}
}
public struct FeatureFlags: Sendable {
public let requirePaywall: Bool
public let featureX: Bool
public init(distribution: Distribution) {
switch distribution {
case .debug: requirePaywall = true; featureX = true
case .testflight: requirePaywall = false; featureX = true
case .appstore: requirePaywall = true; featureX = false
}
}
}Declare the environment value and inject once at the root:
extension EnvironmentValues {
@Entry var featureFlags = FeatureFlags(distribution: .current)
}
RootView()
.environment(\.featureFlags, FeatureFlags(distribution: .current))Views read featureFlags.requirePaywall. Incomplete work stays on main behind a flag. Delete the flag when the feature is proven in App Store.
Do not ship TestFlight values (requirePaywall = false) in the App Store config. Flags that live forever become a second product matrix.
Sources
- https://swiftwithmajid.com/2025/09/16/feature-flags-in-swift/
- https://developer.apple.com/documentation/xcode/configuring-the-build-settings-of-a-target
- https://developer.apple.com/documentation/xcode/build-settings-reference
- https://developer.apple.com/documentation/swiftui/entry()
- https://sarunw.com/posts/how-to-check-if-swift-code-is-in-debug-build-configuration/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

