Home Articles

PR Review Using Copilot: Smarter Reviews, Faster Merges

Introduction

Smarter Reviews, Faster Merges

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.

Installation

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

GitHub Copilot Installation

Authorization

We should authorize the GitHub Copilot with the Cursor IDE. It will redirect to https://github.com/login/device/confirmation

Authorization - GitHub and Cursor

Authorization - GitHub and Cursor

GitHub Copilot Configuration

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

"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

iOS File Associations

"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.

File & Search Exclusions

"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, Terminal, and Extensions

"git.ignoreLimitWarning": true,
"terminal.integrated.defaultProfile.osx": "zsh",
"extensions.recommendations": ["GitHub.copilot", "swift.sourcekit-lsp", ...]

Git Terminal

SwiftUI Snippets

"swift_snippets": { "SwiftUI View": { ... }, "ObservableObject": { ... } }

SwiftUI Snippet

Copilot Commands

"copilot_prompts": { "context_setup": [ ... ], "swiftui_patterns": [ ... ], ... }

Copilot Prompts

Detailed 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

Cursor Feature alongside GitHub Copilot

We should give a try the Cursor Tab Completion feature:

Tab Completion

Tab Completion

Prompts using GitHub Copilot

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

Configuration File - GitHub Copilot

I think we can explore GitHub Copilot by prompting “Use Task for background work”

Prompt

Prompt

Amazing!

We are able to get the accurate results using GitHub Copilot.

Copilot Response

Copilot Response

Code Review - GitHub Copilot in Cursor IDE

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

Source Control - Code Changes

Click Copilot Code Review Icon available in Source Control

Copilot Code Review - Uncommitted Changes

Copilot Code Review - Uncommitted Changes

Animated Version:

Copilot Code Review Option

Copilot Code Review Option

Improper Usage - Force Unwrapping - Runtime issues

Hurray! we got the Code review from GitHub Copilot

Code Review - GitHub Copilot

Code Review - GitHub Copilot

GitHub Pull Request

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

Creating Pull Request

PR Summary

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

Generating Pull Request Summary

Woohoo!
Click Create Pull Request.

Click Create Pull Request

Click Create Pull Request

Code Review Examples

Let’s talk about something that happens after Pull Request.

Pull Request Overview

Pull Request Overview

Comments on the changes

Comments on the changes

Force Unwrapping Optionals

Force Unwrapping Optionals

Use do-try-catch block to handle potential errors

Use do-try-catch block to handle potential errors

weak self Closures to prevent retain cycles

weak self Closures to prevent retain cycles

SPONSOR

iOS Conference AI Image

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!

Final Thoughts

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.