用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/CharlesWiltgen/Axiom --skill axiom-implement-iap命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Use when making design decisions, implementing HIG patterns, Liquid Glass, SF Symbols, typography, or structuring app entry points and authentication flows.
Use when building, fixing, or improving ANY SwiftUI UI — views, navigation, layout, animations, performance, architecture, gestures, debugging, iOS 26 features.
Use when making design decisions, implementing HIG patterns, Liquid Glass, SF Symbols, typography, or structuring app entry points and authentication flows.
基于 SOC 职业分类
正在显示 SKILL.md
| name | axiom-implement-iap |
| description | Use when the user wants to add in-app purchases, implement StoreKit 2, or set up subscriptions. |
| license | MIT |
Note: This audit may use Bash commands to run builds, tests, or CLI tools.
You are an expert at implementing production-ready in-app purchases using StoreKit 2.
Implement complete IAP following testing-first workflow:
Ask the user:
com.company.app.product_nameCRITICAL: Create .storekit file BEFORE any Swift code!
Create StoreManager.swift with these essential components:
@MainActor
final class StoreManager: ObservableObject {
@Published private(set) var products: [Product] = []
@Published private(set) var purchasedProductIDs: Set<String> = []
private var transactionListener: Task<Void, Never>?
init(productIDs: [String]) {
// Start transaction listener IMMEDIATELY
transactionListener = listenForTransactions()
Task { await loadProducts(); await updatePurchasedProducts() }
}
// CRITICAL: Transaction listener handles ALL purchase sources
func listenForTransactions() -> Task<Void, Never> {
Task.detached { [weak self] in
for await result in Transaction.updates {
await self?.handleTransaction(result)
}
}
}
private func handleTransaction(_ : <>) {
transaction result.payloadValue { }
transaction.revocationDate {
transaction.finish()
}
grantEntitlement(for: transaction)
transaction.finish()
updatePurchasedProducts()
}
( : , : ) -> {
result product.purchase(confirmIn: scene)
result {
.success( verification):
tx verification.payloadValue { }
grantEntitlement(for: tx)
tx.finish()
.userCancelled, .pending:
:
}
}
() {
.sync()
updatePurchasedProducts()
}
}
Custom View or StoreKit Views (iOS 17+):
// Custom
Button(product.displayPrice) {
Task { _ = try await store.purchase(product, confirmIn: scene) }
}
// StoreKit Views (simpler)
StoreKit.StoreView(ids: productIDs)
SubscriptionStoreView(groupID: "pro_tier")
Check subscription status via:
let statuses = try? await Product.SubscriptionInfo.status(for: groupID)
// Handle: .subscribed, .expired, .inGracePeriod, .inBillingRetryPeriod
App Store Requirement: Non-consumables/subscriptions MUST have restore:
Button("Restore Purchases") {
Task { await store.restorePurchases() }
}
Products.storekit - Configuration fileStoreManager.swift - Centralized IAP managerFor detailed patterns: axiom-integration (skills/in-app-purchases.md)
For API reference: axiom-integration (skills/storekit-ref.md)
For auditing: iap-auditor agent