Skip to content

Remove swiftSettings that cause errors when building as a dependency in Xcode#110

Closed
rgoldberg wants to merge 1 commit intorarestype:masterfrom
rgoldberg:108-xcode-build-as-dependency
Closed

Remove swiftSettings that cause errors when building as a dependency in Xcode#110
rgoldberg wants to merge 1 commit intorarestype:masterfrom
rgoldberg:108-xcode-build-as-dependency

Conversation

@rgoldberg
Copy link
Contributor

Remove swiftSettings that cause errors when building as a dependency in Xcode.

Resolve #108

…in Xcode.

Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the compatibility of the Swift package by removing problematic swiftSettings that previously led to build failures when the package was consumed as a dependency in Xcode. The change aims to streamline the integration process for other projects and resolve a known issue, ensuring a smoother development experience for users of this package.

Highlights

Changelog
  • Package.swift
    • Removed custom swiftSettings that caused build errors when the package was used as a dependency in Xcode.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request removes swiftSettings from Package.swift to resolve build errors when this package is used as a dependency. My review includes a suggestion to conditionally apply these settings. This would preserve the strict checks for local development while still fixing the issue for consumers of the package.

I am having trouble creating individual review comments. Click here to see my feedback.

Package.swift (88-104)

medium

While removing these Swift settings fixes the build errors for consumers of this package, it also removes valuable checks for the development of the package itself. These settings help enforce modern Swift practices and prevent certain types of warnings.

A better approach could be to apply these settings conditionally, so they are used during local development and CI, but not when the package is used as a dependency. This can be achieved using an environment variable.

For example, you could modify your Package.swift like this:

// At the top of Package.swift
import PackageDescription
import Foundation

// Check for a development environment variable
let isDevelopment = ProcessInfo.processInfo.environment["DEVELOPMENT"] != nil

let swiftSettings: [SwiftSetting] = isDevelopment ? [
    .enableUpcomingFeature("ExistentialAny"),
    .treatWarning("ExistentialAny", as: .error),
    .treatWarning("MutableGlobalVariable", as: .error),
] : []

// Then, for each relevant target:
.target(
    name: "SomeTarget",
    dependencies: [...],
    swiftSettings: swiftSettings
),

This way, you can run DEVELOPMENT=1 swift build to build with the strict settings, while regular users of your package won't be affected. This would allow you to keep the benefits of these checks without impacting downstream users.

@tayloraswift
Copy link
Member

superseded by #112

@rgoldberg rgoldberg deleted the 108-xcode-build-as-dependency branch March 15, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflicting options '-Werror' and '-suppress-warnings' build error when using as a dependency in Xcode 26.3 on macOS 26.3.1

2 participants