Goal: Use Copilot Vision to generate code from UI designs and screenshots.
Note: Copilot Vision may require specific feature flags or preview access. Check if it's available in your Copilot for Xcode installation.
Copilot Vision enables the AI to "see" and understand visual content like UI mockups, screenshots, and design files. You can upload images directly in the chat, and Copilot will generate code that matches the design.
Create a new custom landmark card component from a design mockup.
-
Prepare your design: Take a screenshot or find a design mockup of a card UI you want to implement (e.g., a modern card with image, title, subtitle, and action buttons)
-
Create a new Swift file:
- In Xcode, right-click on
Landmarks/Viewsfolder - Select New File → SwiftUI View
- Name it
LandmarkCard.swift
- In Xcode, right-click on
-
Open Copilot Chat panel in Agent mode
-
Click the Attach Image button (📎 icon) and upload your design mockup
-
Enter a prompt like:
Create a new SwiftUI view called LandmarkCard based on this design mockup.
The card should:
- Display a landmark image at the top
- Show the landmark name and location
- Include a favorite button
- Use the app's existing color scheme and follow iOS design guidelines
- Be reusable with any Landmark model
Make it responsive for different screen sizes.
-
Copilot will analyze the image and generate SwiftUI code in the new file
-
Review the generated code and test it by:
- Adding a preview at the bottom of the file
- Using it in
LandmarkListto replace existing row views
Create this card component in SwiftUI with proper spacing, shadows, and rounded cornersBuild a settings panel based on this screenshot, matching the iOS native style
- Use clear, high-resolution images or screenshots
- Provide specific requirements (colors, fonts, spacing)
- Mention the data model to use (e.g., "use the Landmark model")
- Specify platform requirements (iOS version, device sizes)
- Request specific SwiftUI features if needed (LazyVGrid, GeometryReader, etc.)
- Create a custom detail header based on a design mockup
- Implement a statistics dashboard view from an image
- Build a custom filter/sort menu UI from a screenshot
You've learned how to:
- Upload design mockups to Copilot Chat
- Generate SwiftUI code from visual designs
- Iterate on vision-generated code for better results