Skip to content

Instantly share code, notes, and snippets.

@janeshsutharios
Created August 1, 2025 15:40
Show Gist options
  • Select an option

  • Save janeshsutharios/9a1aeac76eecb2ac075cc1b7d0d7a6fb to your computer and use it in GitHub Desktop.

Select an option

Save janeshsutharios/9a1aeac76eecb2ac075cc1b7d0d7a6fb to your computer and use it in GitHub Desktop.
Adding swift 6 concurrency with packages
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Common",
platforms: [
.iOS(.v15),
],
products: [
.library(
name: "Common",
targets: ["Common"]
),
],
targets: [
.target(
name: "Common",
swiftSettings: [
// ✅ Enable Swift 6-style concurrency warnings
.enableUpcomingFeature("StrictConcurrency"),
// Enable Swift version warnings without failing the build
.unsafeFlags(["-warn-swift3-objc-inference-complete"]),
.unsafeFlags(["-warn-implicit-overrides"]),
.unsafeFlags(["-warn-concurrency"]),
// Alternatively, you can use this to get all Swift 6 migration warnings:
.unsafeFlags(["-enable-upcoming-feature", "ConciseMagicFile"]),
.unsafeFlags(["-enable-upcoming-feature", "ForwardTrailingClosures"]),
.unsafeFlags(["-enable-upcoming-feature", "ExistentialAny"]),
.unsafeFlags(["-enable-upcoming-feature", "BareSlashRegexLiterals"]),
// For strict concurrency checking (warnings only)
.unsafeFlags(["-Xfrontend", "-warn-concurrency"]),
.unsafeFlags(["-Xfrontend", "-enable-actor-data-race-checks"])
]
),
.testTarget(
name: "CommonTests",
dependencies: ["Common"]
),
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment