Xcode 27 System Prompts and Documentation
repository·main·Indexed 19 days ago
https://github.com/artemnovichkov/xcode-27-system-promptsA collection of system prompts, agent skills, and technical documentation extracted from Xcode 27. It includes .idechatprompttemplate files for coding and reasoning, specialized Agent Skills for security audits and SwiftUI, and reference guides for iOS 26/27 features such as on-device LLMs, Liquid Glass Design, and AppIntents integration with Visual Intelligence.
What's inside xcode-27-system-prompts
- AlarmKit is an iOS 18 framework for creating custom alarms and timers. It allows developers to manage schedules (one-time or repeating), create countdown timers, and customize the UI for alerts, countdowns, and paused states. It integrates with Live Activities (Dynamic Island and Lock Screen) and can override device focus and silent modes.
What is Liquid Glass design in AppKit?
mainLiquid Glass is a dynamic material design that creates an immersive UI by blurring content behind it, reflecting surrounding colors/light, and reacting to user interactions in real time. In AppKit, this is implemented using two primary classes:NSGlassEffectViewfor individual glass elements andNSGlassEffectContainerViewfor managing groups of glass elements that can merge together.Overview of SwiftUI WebKit Integration
mainSwiftUI integrates with WebKit via the
WebViewstruct and theWebPageclass. This allows embedding web content (HTML, CSS, JS) into native SwiftUI apps with support for navigation, JavaScript execution, and deep customization.Core Components:
WebView: The SwiftUI view used to display web content.WebPage: An observable class used to control and manage web content behavior, navigation, and state.- JavaScript Interaction: Capabilities to execute scripts and pass data between Swift and JS.
- Navigation Management: Tools for loading URLs, HTML, or data, and managing history.
Overview of Visual Intelligence in iOS
mainVisual Intelligence is a framework that allows iOS apps to integrate with system-wide visual search capabilities (via camera or screenshots). When a user performs a visual search, your app can provide relevant content that matches what they are looking at.
Core Workflow:
- The Visual Intelligence framework detects objects in the camera or screenshots.
- The App Intents framework facilitates the exchange of this information with your app.
- Your app searches its own content for matches.
- Your app returns matches as app entities, which appear directly in the system's visual search interface.
Configure Intent Modes with supportedModes
mainUse the
supportedModesproperty on anAppIntentto control how and when the app is foregrounded during execution.Available
IntentModes:.background: Intent performs entirely in the background..foreground(.immediate): App is foregrounded immediately beforeperform()runs..foreground(.dynamic): App can be foregrounded during execution based on runtime conditions..foreground(.deferred): App performs in background initially but will be foregrounded before completion.
You can combine modes (e.g.,
[.background, .foreground(.dynamic)]) to provide a background fallback with the ability to request the foreground.struct GetCrowdStatusIntent: AppIntent { static let supportedModes: IntentModes = [.background, .foreground(.dynamic)] func perform() async throws -> some ReturnsValue<Int> & ProvidesDialog { // ... implementation } }Handle accented rendering and background removal
mainvisionOS supports Full Color (default) and Accented rendering modes. In Accented mode, the background is removed and replaced with a solid color matching the user's theme.
To support this correctly:
- Use
.containerBackground(for: .widget)to mark your background view. This allows the system to remove it when necessary. - Use the
@Environment(\.showsWidgetContainerBackground)property wrapper to detect if the widget is currently being rendered with or without its background. - Ensure your widget design remains legible even when the background is removed.
// Use containerBackground to mark removable backgrounds var body: some View { VStack { // Widget content } .containerBackground(for: .widget) { Color.gameBackground } } // Detect background presence @Environment(\.showsWidgetContainerBackground) var showsBackground- Use
Use SemanticContentDescriptor to access visual data
mainThe
SemanticContentDescriptoris the primary object used to describe what the user is looking at. It provides two main ways to identify content:labels: [String]: A list of labels used by Visual Intelligence to classify items.pixelBuffer: CVReadOnlyPixelBuffer?: The raw visual data from the camera or screenshot.
You can implement your search logic to use either the labels, the pixel buffer, or both.
Use SupportingPlaceRepresentation for service-specific IDs
mainTo link a
PlaceDescriptorto specific proprietary IDs from third-party mapping services (like Google Maps or Apple Maps), useSupportingPlaceRepresentationwith the.serviceIdentifierscase. This takes a dictionary mapping service provider strings to their respective place IDs.You can retrieve a specific ID using
descriptor.serviceIdentifier(for: "service_name").// Create with service identifiers let landmark = PlaceDescriptor( representations: [.address("1 Infinite Loop, Cupertino, CA 95014")], commonName: "Apple Park", supportingRepresentations: [ .serviceIdentifiers(["com.apple.maps": "ABC123XYZ", "com.google.maps": "ChIJq6qq6jK1j4ARzl-WRHNx9CI"]) ] ) // Retrieve a specific ID let appleID = landmark.serviceIdentifier(for: "com.apple.maps")Combine multiple glass elements with UIGlassContainerEffect
mainUse
UIGlassContainerEffectto group multipleUIGlassEffectelements. This allows them to blend and morph into one another when they are positioned close to each other. Thespacingproperty determines the distance at which elements begin to merge.// Create a glass container effect let containerEffect = UIGlassContainerEffect() containerEffect.spacing = 40.0 // Distance at which elements begin to merge // Create the main container visual effect view let containerView = UIVisualEffectView(effect: containerEffect) containerView.frame = CGRect(x: 50, y: 400, width: 300, height: 200) // Create the first glass element let firstGlassEffect = UIGlassEffect() let firstGlassView = UIVisualEffectView(effect: firstGlassEffect) firstGlassView.frame = CGRect(x: 20, y: 20, width: 100, height: 100) firstGlassView.layer.cornerRadius = 20 firstGlassView.clipsToBounds = true // Create the second glass element let secondGlassEffect = UIGlassEffect() secondGlassEffect.tintColor = UIColor.systemPink.withAlphaComponent(0.3) let secondGlassView = UIVisualEffectView(effect: secondGlassEffect) secondGlassView.frame = CGRect(x: 80, y: 60, width: 100, height: 100) secondGlassView.layer.cornerRadius = 20 secondGlassView.clipsToBounds = true // Add the glass elements to the container's contentView containerView.contentView.addSubview(firstGlassView) containerView.contentView.addSubview(secondGlassView) // Add the container to your view hierarchy view.addSubview(containerView)Create and manage LanguageModelSession
mainA
LanguageModelSessionis used to interact with the model.- Single-turn interactions: Create a new session for each request.
- Multi-turn interactions: Reuse the same session instance to maintain conversation context.
- Concurrency: A session can only handle one request at a time. Check the
isRespondingproperty before sending a new request to ensure the session is available.
// Basic session let session = LanguageModelSession() // Session with system instructions to steer behavior let instructions = """ You are a helpful assistant that provides concise answers. Keep responses under 100 words and focus on clarity. """ let sessionWithInstructions = LanguageModelSession(instructions: instructions)Manage multiple glass effects with GlassEffectContainer
mainWhen applying Liquid Glass to multiple views, wrap them in a
GlassEffectContainerto improve rendering performance and enable blending and morphing effects between the glass elements.The
spacingparameter determines how the effects interact:- Smaller spacing: Views must be closer to merge effects.
- Larger spacing: Effects merge at greater distances.
GlassEffectContainer(spacing: 40.0) { HStack(spacing: 40.0) { Image(systemName: "scribble.variable") .glassEffect() Image(systemName: "eraser.fill") .glassEffect() } }Understand the System Prompt Template structure
mainXcode uses
.idechatprompttemplatefiles to power its AI coding assistant. These templates are categorized by their role in the development workflow:Basic Coding & Reasoning
BasicSystemPrompt.idechatprompttemplate: Foundation for code analysis.ReasoningSystemPrompt.idechatprompttemplate: Enhanced reasoning for complex tasks.VariantASystemPrompt.idechatprompttemplate/VariantBSystemPrompt.idechatprompttemplate: Alternative prompt variants.
Specialized Workflows
IntegratorSystemPrompt.idechatprompttemplate: Precise code editing.NewCodeIntegratorSystemPrompt.idechatprompttemplate: Integrating entirely new code blocks.FastApplyIntegratorSystemPrompt.idechatprompttemplate: Rapid modifications.PlannerExecutorStylePlannerSystemPrompt.idechatprompttemplate: Planning-based coding.
Context Providers
These templates define how the AI perceives the current state of your project:
CurrentFile.idechatprompttemplate: Full current file context.CurrentSelection.idechatprompttemplate: Only the selected code.OriginalFile.idechatprompttemplate: The original state of the file before edits.
Tool-Assisted & Agent Modes
ToolAssistedBasicSystemPrompt.idechatprompttemplate: Enables search and editing tools.AgentSystemPromptAddition.idechatprompttemplate: Adds MCP tools, documentation search, and code style guidelines to the agent mode.AgentAdditionalContext.idechatprompttemplate: Provides project structure and file context for the agent.