Smarter Reviews, Faster Merges
When developing iOS apps with Swift and SwiftUI, you want your tools to work for you. This settings.json file configures Cursor IDE and GitHub Copilot to provide the best possible developer experience for Swift projects.
You can install CodeRabbit extension directly in Cursor IDE or VS Code directly. This will help us in reviewing the code changes (both uncommitted and committed).
GitHub Copilot Installation
We should authorize the GitHub Copilot with the Cursor IDE. It will redirect to https://github.com/login/device/confirmation
Authorization - GitHub and Cursor
Before GitHub Copilot Code Review, we will understand the GitHub Copilot Configuration. It should be placed under the following path
ℹ️
RepoDirectory/.cursor/settings.json
"github.copilot.enable": { "*": true, "swift": true, ... }
Copilot Configuration
Copilot Everywhere: Enables Copilot suggestions in multiple languages, including Swift, Objective-C, YAML, Markdown, and JSON.
Smart Inline Suggestions:
"github.copilot.inlineSuggest.enable": true
"github.copilot.editor.enableAutoCompletions": true
"github.copilot.editor.enableCodeActions": true
This ensures Copilot assists you while typing Swift code, suggesting snippets, refactors, and even SwiftUI components.
"swift.languageServer.enable": true,
"swift.sourcekit.enable": true,
"swift.formatting.enable": true,
swift languageServer and sourceKit
"files.associations": { "*.swift": "swift", "*.h": "objective-c", "*.storyboard": "xml", ... }
iOS file associations
This section helps Cursor understand file types in iOS projects:
.swift → Swift.
.storyboard, .xib, .plist → XML.
"files.exclude": { "**/Pods": true, "**/DerivedData": true, ... }
"search.exclude": { "**/Pods": true, "**/DerivedData": true, ... }
File Exclusion
This hides build artifacts and dependency folders from search and explorer such as Pods, carthage, .swiftpm
"git.ignoreLimitWarning": true,
"terminal.integrated.defaultProfile.osx": "zsh",
"extensions.recommendations": ["GitHub.copilot", "swift.sourcekit-lsp", ...]
Git Terminal
"swift_snippets": { "SwiftUI View": { ... }, "ObservableObject": { ... } }
SwiftUI Snippet
"copilot_prompts": { "context_setup": [ ... ], "swiftui_patterns": [ ... ], ... }
Copilot Prompts
"copilot_prompts": {
"description": "Effective prompts for GitHub Copilot in iOS development",
"context_setup": [
"// iOS App using SwiftUI and Swift 5.9+",
"// Target: iOS 15.0+",
"// Architecture: MVVM with Combine",
"// Dependencies: None/SPM packages"
],
"swiftui_patterns": [
"// SwiftUI best practices:",
"// - Use @State for local view state",
"// - Use @StateObject for view models",
"// - Use @ObservedObject for passed objects",
"// - Use @EnvironmentObject for shared state"
],
"async_patterns": [
"// Modern Swift concurrency:",
"// - Use async/await for networking",
"// - Use Task for background work",
"// - Use @MainActor for UI updates"
]
}
GitHub Copilot Prompts
We should give a try the Cursor Tab Completion feature:
Tab Completion
GitHub Copilot uses the LLM models to generate the response. For this, we should provide a meaningful prompts so that this will help to provide accurate results.
You can take a quick animated view of settings.json - configuration file for GitHub Copilot.
Configuration File - GitHub Copilot
I think we can explore GitHub Copilot by prompting “Use Task for background work”
Prompt
Amazing!
We are able to get the accurate results using GitHub Copilot.
Copilot Response
We can review the code using GitHub Copilot before pushing the code to the branch or creating a Pull Request.
Let’s review what are the code changes we made:
Once reviewed, select Generate commit message using GitHub Copilot
This will help us to understand how to have a meaningful commit message.
Source Control - Code Changes
Click Copilot Code Review Icon available in Source Control
Copilot Code Review - Uncommitted Changes
Animated Version:
Copilot Code Review Option
Hurray! we got the Code review from GitHub Copilot
Code Review - GitHub Copilot
I think it’s right time to create a Pull Request in GitHub.com. Assigning the GitHub Copilot as Code Reviewers. Copilot really assists developers in terms of code review.
This enables Copilot can review our code in this PR.
Creating Pull Request
Pull Request is a crucial skill while working with a group of people as a team. Writing a meaningful Pull Request is still a challenge for many developers.
Let’s understand how GitHub Copilot generates PR Summary
Generating Pull Request Summary
Woohoo!
Click Create Pull Request.
Click Create Pull Request
Let’s talk about something that happens after Pull Request.
Pull Request Overview
Comments on the changes
Force Unwrapping Optionals
Use do-try-catch block to handle potential errors
weak self Closures to prevent retain cycles
SPONSOR
The Unique iOS Swift Conference in the UK
SwiftLeeds is a premier iOS conference taking place on October 7-8 this year. If you’re looking to stay updated on the latest trends in iOS development and connect with like-minded professionals, this event is a must-attend! Don’t miss out—book your tickets now!
Get your tickets!GitHub Copilot is your AI-powered coding companion—a pair programmer that accelerates development, presents new ideas, and helps you stay focused on what matters most: building great apps.
It’s about writing code smarter.
GitHub Copilot becomes more than an autocomplete tool—it becomes an essential part of your developer toolkit. Type that first character, and let Copilot do the rest.
It’s not just generate code but also review your code.
Note
Please find the GitHub PR Code Review for reference.
This is a free third party commenting service we are using for you, which needs you to sign in to post a comment, but the good bit is you can stay anonymous while commenting.