Communitygithub.com

dpearson2699/tipkit

使用 Apple 的 TipKit 框架实现、审查或改进应用内提示和引导流程。适用于添加功能发现提示、引导流程、上下文提示、首次运行体验、操作指引,或处理 Tip 协议、TipView、popoverTip、提示规则、提示事件及功能教育 UI。

tipkit 是什么?

该技能专注于利用 Apple 的 TipKit 框架(适用于 iOS 17+、macOS 14+、tvOS 17+、watchOS 10+)实现、审查或改进应用内提示和引导流程。它适合添加功能发现提示、引导流程、上下文提示、首次运行体验或操作指引。核心功能包括使用 Tip 协议定义提示、利用 TipView 和 popoverTip 展示 UI、设置提示规则(如基于参数或自定义事件)、触发具有冷却期的提示事件,以及进行批量操作如重置所有提示。该技能提供清晰的代码示例,涵盖定义、展示、规则和事件配置,帮助开发者高效集成提示功能,提升用户体验,无需手动重新创建常见模式。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/tipkit

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

tipkit 是做什么的?

使用 Apple 的 TipKit 框架实现、审查或改进应用内提示和引导流程。适用于添加功能发现提示、引导流程、上下文提示、首次运行体验、操作指引,或处理 Tip 协议、TipView、popoverTip、提示规则、提示事件及功能教育 UI。

概述

dpearson2699/tipkit 技能提供使用 Apple 的 TipKit 框架在应用内实现功能发现提示、引导流程和上下文提示的指导。涵盖从定义 Tip 协议到使用 TipView 和 popoverTip 展示 UI 的所有内容,包括提示规则和提示事件。

适用场景

当任务涉及以下方面时,使用此技能:

  • 添加功能发现提示(如“试试此新功能!”)
  • 实现引导流程(如使用 TipView 或 popoverTip 的分步提示)
  • 创建上下文提示(基于特定操作或条件显示)
  • 设计首次运行体验的提示
  • 在现有代码中审查或调试提示实现
  • 设置提示规则(如限制显示频率或基于条件显示)
  • 配置提示事件(如用户完成操作后触发提示)

平台支持

  • iOS 17.0+
  • macOS 14.0+
  • tvOS 17.0+
  • watchOS 10.0+

主要组成部分

1. 定义 Tip

通过遵循 Tip 协议创建提示:

struct NewFeatureTip: Tip {
    var title: Text {
        Text("开始新功能")
    }

    var message: Text? {
        Text("探索我们全新的排版方式,更易组织内容。")
    }

    var image: Image? {
        Image(systemName: "star.fill")
    }
}

2. 展示 Tip

使用 TipView 或 popoverTip 修饰符:

struct ContentView: View {
    static let newFeatureTip = NewFeatureTip()
    
    var body: some View {
        VStack {
            // 嵌入视图中的提示
            TipView(Self.newFeatureTip)
            
            // 或作为弹出提示
            Button("操作") { }
                .popoverTip(Self.newFeatureTip)
        }
    }
}

3. 提示规则

控制提示的显示方式:

struct ConditionalTip: Tip {
    @Parameter
    static var shouldShow: Bool = false
    
    var title: Text {
        Text("条件提示")
    }
    
    var rules: [Rule] {
        #Rule(Self.$shouldShow) { $0 == true }
    }
}

4. 提示事件

基于用户操作触发提示:

struct EventDrivenTip: Tip {
    static let didCompleteAction = Event(id: "didCompleteAction")
    
    var title: Text {
        Text("干得好!")
    }
    
    var rules: [Rule] {
        #Rule(Self.didCompleteAction) { $0.donations.count >= 3 }
    }
}

5. 重置提示

在 Xcode Previews 或测试中:

import TipKit

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
            .task {
                try? Tips.resetAll()
            }
    }
}

最佳实践

  • 上下文相关:仅在相关时显示提示(避免干扰或混淆)
  • 简洁:提示应简短且可操作
  • 可关闭:确保用户能轻松关闭提示
  • 频率限制:使用提示规则限制显示频率
  • 事件驱动:用提示事件在正确时机触发提示
  • 可访问性:确保提示与 VoiceOver 兼容,不影响导航

常见陷阱

  • 过度提示:避免同一时间内显示过多提示
  • 过时提示:用户熟悉功能后隐藏提示
  • UI 阻塞:提示不应阻止用户与应用交互
  • 规则冲突:确保提示规则不冲突导致意外行为
  • 事件管理:避免多事件提示导致显示不一致

示例项目

使用此技能开发完整示例时,推荐包含:

  1. 从 Tip 协议定义的操作提示
  2. 使用 TipView 或 popoverTip 展示
  3. 基于规则或事件的提示控制逻辑

故障排除

  • 提示不显示:检查框架是否以 .tipsEnabled() 配置,验证规则和事件条件
  • 重复显示:检查冷却期或事件捐赠条件
  • 布局问题:确认 TipView 在父视图中获得足够空间

配置

import TipKit

struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
                .task {
                    // 配置提示配置
                    try? Tips.configure([
                        .displayFrequency(.immediate),
                        .datastoreLocation(.applicationDefault)
                    ])
                }
        }
    }
}

调试

  • 对特定提示使用 .tipViewStyle(.miniTip) 预览样式
  • 使用 Tips.resetAll() 重置测试提示状态
  • 检查控制台输出中的 [TipKit] 日志消息

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

dpearson2699/accessorysetupkit

Discover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions.

dpearson2699/activitykit

Implement, review, or improve Live Activities and Dynamic Island experiences in iOS apps using ActivityKit. Use when building real-time updating widgets for the Lock Screen and Dynamic Island — delivery tracking, sports scores, ride-sharing status, workout timers, media playback, or any time-sensitive information that updates in real time. Also use when working with ActivityKit, ActivityAttributes, Activity lifecycle (request/update/end), Dynamic Island layouts (compact/minimal/expanded), push-to-update Live Activities, or Lock Screen live widgets.

dpearson2699/adattributionkit

Measure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement.

dpearson2699/alarmkit

Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, and Apple Watch system UI. Covers AlarmManager scheduling, AlarmAttributes and AlarmPresentation, AlarmButton stop and snooze actions, authorization, state observation, and Live Activity integration. Use when building wake-up alarms, countdown timers, or alarm-style alerts that need Apple's system alarm experience.

dpearson2699/app-clips

Build iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences, size/capability constraints, NSUserActivity routing, SKOverlay promotion, App Group/keychain handoff, ephemeral notifications, location confirmation, and full-app migration. Use when creating App Clips or wiring App Clip invocation, experience configuration, or full-app handoff.

dpearson2699/app-intents

Implement App Intents for Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence on iOS. Covers AppIntent actions, AppEntity and EntityQuery models, AppShortcutsProvider phrases, IndexedEntity Spotlight indexing, WidgetConfigurationIntent, SnippetIntent, and assistant schemas. Use when exposing app actions or entities to system surfaces.

dpearson2699/apple-on-device-ai

Integrate on-device AI using Foundation Models framework, Core ML, and open-source LLM runtimes on Apple Silicon. Covers Foundation Models (LanguageModelSession, @Generable, @Guide, SystemLanguageModel, structured output, tool calling), Core ML (coremltools, model conversion, quantization, palettization, pruning, Neural Engine, MLTensor), MLX Swift (transformer inference, unified memory), and llama.cpp (GGUF, cross-platform LLM). Use when building tool-calling AI features, working with guided generation schemas, converting models, or running on-device inference.

dpearson2699/appmigrationkit

Transfer app data to or from other platforms using AppMigrationKit. Use when implementing system-orchestrated one-time migration between iOS and Android or another platform, building an AppMigrationExtension, packaging transportable resources with ResourcesArchiver, importing resources on the destination device, reporting import progress, handling migration errors and app group cleanup, checking MigrationStatus, or testing migration code with AppMigrationTester.

dpearson2699/app-store-review

Prepare for App Store review and prevent rejections. Covers App Store review guidelines, app rejection reasons, PrivacyInfo.xcprivacy privacy manifest requirements, required API reason codes, in-app purchase IAP and StoreKit rules, App Store Guidelines compliance, ATT App Tracking Transparency, EU DMA Digital Markets Act, HIG compliance checklist, app submission preparation, review preparation, metadata requirements, entitlements, widgets, and Live Activities review rules. Use when preparing for App Store submission, fixing rejection reasons, auditing privacy manifests, implementing ATT consent flow, configuring StoreKit IAP, or checking HIG compliance.

dpearson2699/audioaccessorykit

Support audio accessory features like automatic switching using AudioAccessoryKit. Use when implementing automatic audio routing for paired accessories, registering audio accessory configuration from the container app, updating placement or connected audio source identifiers from an app extension, or handling AccessoryControlDevice capabilities and errors.

dpearson2699/authentication

Implement iOS authentication flows with AuthenticationServices and LocalAuthentication. Use when building Sign in with Apple, passkey/WebAuthn registration or sign-in with ASAuthorizationPlatformPublicKeyCredentialProvider, ASAuthorizationController credential state and revocation handling, ASWebAuthenticationSession OAuth or third-party login, Password AutoFill, identity-token server validation, or local biometric re-authentication with LAContext.

dpearson2699/avkit

Create media playback experiences using AVKit. Use when adding video players with AVPlayerViewController, enabling Picture-in-Picture, routing media with AirPlay, using SwiftUI VideoPlayer views, configuring transport controls, displaying subtitles and closed captions, or integrating AVFoundation playback with system UI.

dpearson2699/background-processing

Schedule and execute background work on iOS using BGTaskScheduler. Use when registering BGAppRefreshTask for short background fetches, BGProcessingTask for long-running maintenance, BGContinuedProcessingTask (iOS 26+) for foreground-started work that continues in background, background URLSession downloads, or background push notifications. Covers Info.plist configuration, expiration handling, task completion, and debugging with simulated launches.

dpearson2699/browserenginekit

Build alternative browser engines using BrowserEngineKit. Use when developing a non-WebKit browser engine for iOS/iPadOS in supported regions, managing web content/rendering/networking extension processes, configuring GPU and networking process capabilities, checking alternative-engine device eligibility, or reviewing BrowserEngineKit entitlements and Info.plist setup.

dpearson2699/callkit

Implement VoIP calling with CallKit and PushKit. Use when building incoming/outgoing call flows, registering for VoIP push notifications, configuring CXProvider and CXCallController, handling call actions, coordinating audio sessions, or creating Call Directory extensions for caller ID and call blocking.

dpearson2699/carplay

Build CarPlay-enabled apps using the CarPlay framework. Use when creating navigation, audio, communication, EV charging, parking, or food ordering apps for the car display, working with CPTemplateApplicationScene, CPInterfaceController template hierarchies, CPListTemplate, CPMapTemplate, CPNowPlayingTemplate, configuring CarPlay entitlements, or integrating with CarPlay Simulator for testing.

dpearson2699/cloudkit

Implement, review, or improve CloudKit and iCloud sync in iOS/macOS apps. Use when working with CKContainer, CKRecord, CKQuery, CKSubscription, CKSyncEngine, CKShare, NSUbiquitousKeyValueStore, or iCloud Drive file coordination; when syncing SwiftData models via ModelConfiguration with cloudKitDatabase; when handling CKError codes for conflict resolution, network failures, or quota limits; or when checking iCloud account status before performing sync operations.

dpearson2699/contacts-framework

Read, create, update, and pick contacts using the Contacts and ContactsUI frameworks. Use when fetching contact data, saving new contacts, wrapping CNContactPickerViewController in SwiftUI, handling contact permissions, or working with CNContactStore fetch and save requests.

dpearson2699/core-bluetooth

Build direct Bluetooth Low Energy workflows with Core Bluetooth. Use when implementing BLE central or peripheral GATT communication, scanning or connecting with CBCentralManager, discovering services and characteristics, reading/writing/subscribing with CBPeripheral, publishing local services with CBPeripheralManager, handling Bluetooth authorization, background BLE modes, state restoration, write flow control, or CBUUID-based workflows. For privacy-preserving accessory setup/picker flows, use accessorysetupkit first and return here for post-setup GATT communication.

dpearson2699/coreml

Integrate Core ML models in iOS apps for on-device machine learning inference. Covers model loading (.mlmodel, .mlpackage, .mlmodelc), predictions with auto-generated classes and MLFeatureProvider, compute unit configuration (CPU, GPU, Neural Engine), MLTensor, VNCoreMLRequest, MLComputePlan, multi-model pipelines, and deployment strategies. Use when loading Core ML models, making predictions, configuring compute units, or profiling model performance.

相关技能