πŸŽ“ How to Write Better Pull Requests ✍️

February 9, 2025
Sponsored

More efficient Swift package resolution with the Tuist Registry

Tuist has just announced a new solution, Tuist Registry, which makes resolution of packages more efficient. It works with any Xcode project and Swift Package.

Welcome to issue #32 of the iOS Coffee Break Newsletter πŸ“¬.

Who doesn't love code reviews, right? πŸ˜… Recently, I watched Daniela Vrzan's talk, Best-in-class Pull Request from NSSpain 2024, and it gave me the inspiration for this week's issue. I will be sharing some valuable tips to help you improve the way you create Pull Requests and make the review process smoother and more effective.

What is a Pull Request? πŸ€”

A pull request is a way to propose merging a set of changes from one branch into another. It enables team members to review, discuss and provide feedback before the updates are incorporated into the main codebase.

Tips to Write better PRs:

  • Don't do big PRs
  • Concise (write good descriptions)
  • Visual (screenshots/video)
  • Understandable and well-documented
  • Review your own pull request first
  • Avoid nitpicking!

Why and How to Add a PR Template?

By having consistent prompts pre-filled in your description, you will always have a clear structure to follow, ensuring that your reviewers receive all the necessary details efficiently.

  • Create a .github directory at the root of your repository
  • Inside it, add a file named pull_request_template.md
  • Use GitHub's Markdown syntax to include prompts or guidelines that can help contributors provide useful information

From now on, whenever you create a PR, the description field will automatically include your template content! Great Job! πŸ’ͺ

What Should Your Template Include?

You can add any prompts that suit your workflow. Personally, I like to keep it straightforward. Here is an example of a template:

# Problem Overview
- Brief description on what this PR is about
- Attach screenshots or anything valuable to the reviewer to give them context about your PR

# How To Test
- Step 1 
- Step 2 
- Step 3 

# Before And After
|            Before           |               After            |
|             :---:           |               :---:            |    
|       <screenshot here>     |        <screenshot here>       |

# Problem Solution
- Describe key changes 

## Issue
- [Jira task](<link>)

## How does this PR make you feel? (optional)
- [Gif](<link>)

Hopefully, these simple tips will help you turn each pull request into something special, making the review process more efficient and enjoyable for both you and your team 🀘!

CURATED FROM THE COMMUNITY

πŸ—ΊοΈ Drawing maps with Swift Charts

Artem got inspired by a Swift Charts WWDC session and decided to create an application to visualize population data of Kazakhstan πŸ‡°πŸ‡Ώ, the country where he resides.

If you are interested in learning how to create maps using Swift Charts, this article is definitely worth a read!

✌️ Custom Fastlane Actions

While Fastlane offers many built-in actions, there are times when you need a custom solution tailored to your workflow.

In his latest article, Noam explains how to create custom Fastlane actions and also dives into unit testing your Fastlane code!

βœ‚οΈ Swift 5.9: Copyable Syntax

What exactly is a Copyable?

In her latest article, Vera explores the concept of noncopyable structs and enums, a topic that has been gaining traction recently. This new Swift 5.9 feature improves code safety by preventing unintended copying of certain types.

If you are curious to learn more, Vera has put together a clear and insightful article where she shares her findings!

πŸ¦‘ Mastering TaskGroups in Swift

Swift Structured Concurrency simplifies handling multiple asynchronous tasks with task group. These allow you to run a dynamic number of child tasks, wait for all to complete or cancel them if needed.

Majid's latest article dives into how to effectively use and optimize task groups in Swift. It includes several practical code examples to illustrate their implementation, making it a great resource for improving your concurrency skills!