🧑‍✈️ GitHub Copilot for Xcode is now available! ✈️

November 3, 2024

Welcome to the 20th issue of the iOS Coffee Break Newsletter 📬.

This week, GitHub revealed that GitHub Copilot's code completion feature is now available in public preview for Xcode! GitHub Copilot, an AI-powered coding assistant, helps streamline and enhance your coding process. Copilot for Xcode is an Xcode extension that provides inline coding suggestions as you type.

Key Features:

  • Code Completions: Integrated in Xcode, providing inline code suggestions.
  • Multi-Language Support: Compatible with Swift, Objective-C, and other Apple ecosystem languages.
  • Multiline Suggestions: Default single-line suggestions, with multi-line options accessed by holding the Option key and pressing Option + Tab.
  • Content Filtering: Uses filters to prevent inappropriate content, maintaining a professional coding environment.
  • Public Code Blocker: Includes a filter to block suggestions that resemble public GitHub code, preventing code duplication.

Requirements:

  • macOS 12+
  • Xcode 8+
  • A GitHub Copilot subscription. To learn more, visit the official page.

Initial Impressions

I tested it briefly on some sample code, and it feels like a solid improvement over Xcode 16's local predictive model. It is quicker, more precise, and can auto-generate longer code snippets. I will need to spend more time with it for a thorough review, though!

While I don't see myself subscribing for a feature like this, I am always curious to explore these tools and see what they can offer!

For a guide on how to get started, check the docs from GitHub.

Now it is time to dive into some iOS development topics submitted by the community. Here are this week's highlighted resources. Hope you enjoy 🙌.

🧜‍♀️ The Strategy Pattern

Do you aim to simplify when adding new features to existing code? This week, Vera offers her insights on using the Strategy pattern to encapsulate and swap different behaviors with ease.

My advice: take a page from Vera's playbook to avoid turning your "birds" into "merm-birds"!

P.S. You might neeed to read the article to get this one!

🚣‍♂️ Coordinators & SwiftUI

Views on SwiftUI's navigation are divided: some developers support it fully, while others feel it is not yet robust enough for complex apps, even with NavigationStack. I have to admit, my team and I currently use SwiftUI for UI design, but still handle navigation with UIKit by embedding SwiftUI views in UIHostingController — especially since we support iOS 15 and can't use NavigationStack at its full power yet!

In this article, Vitaly investigates whether SwiftUI, specifically NavigationStack, can support the Coordinator pattern. He explores adapting this approach to SwiftUI and demonstrates building a streamlined SwiftUI Coordinator without complex third-party libraries.

Vitaly also offers a video version of this article if you would rather watch than read.

🤖 How to automatically update build and version numbers in your app using Fastlane

In this article, Pol demonstrates how to use Fastlane to streamline updating your app's build and version numbers.

By automating this process, you can ensure your app's version and build numbers are always current before deploying a new release, saving time and reducing errors!

👶 Getting Started with Swift Package Manager

If you are new to Swift Packages and looking to create CLI executables or library targets, this article is a must-read! Joannis explains the essentials of Swift Package Manager, walking you through creating a package, adding dependencies, and linking target dependencies.

Interesting fact: With SwiftPM, you can choose to add dependencies by either editing the manifest (Package.swift) directly or by using the CLI tool — both approaches work seamlessly.

💡 Blog about Swift: Tips and ideas to start your own

Recently, I found an article Antoine shared a few years back that I wish I had seen when I first started blogging about Swift!

If you are already blogging about Swift or planning to start, this article shares Antoine's top tips for writing Swift content effectively. It is full of best practices, so definitely check it out!