The Swift Package Index logo.Swift Package Index

Track the adoption of Swift 6 strict concurrency checks for data race safety. How many packages are Ready for Swift 6?

Build Information

Successful build of DataCache, reference master (bcb54d), with Swift 6.0 for macOS (SPM) on 3 Nov 2024 01:32:07 UTC.

Swift 6 data race errors: 1

Build Command

env DEVELOPER_DIR=/Applications/Xcode-16.1.0.app xcrun swift build --arch arm64 -Xswiftc -Xfrontend -Xswiftc -stats-output-dir -Xswiftc -Xfrontend -Xswiftc .stats -Xswiftc -strict-concurrency=complete

Build Log

========================================
RunAll
========================================
Builder version: 4.56.0
Interrupt handler set up.
========================================
Checkout
========================================
Clone URL: https://github.com/huynguyencong/DataCache.git
Reference: master
Initialized empty Git repository in /Users/admin/builder/spi-builder-workspace/.git/
From https://github.com/huynguyencong/DataCache
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
HEAD is now at bcb54d3 Update Podspec tag and package iOS version
Cloned https://github.com/huynguyencong/DataCache.git
Revision (git rev-parse @):
bcb54d313a6ab16fc3f8fa5884ec0f5f331c6ae3
SUCCESS checkout https://github.com/huynguyencong/DataCache.git at master
========================================
ResolveProductDependencies
========================================
Resolving dependencies ...
{
  "identity": ".resolve-product-dependencies",
  "name": "resolve-dependencies",
  "url": "/Users/admin/builder/spi-builder-workspace/.resolve-product-dependencies",
  "version": "unspecified",
  "path": "/Users/admin/builder/spi-builder-workspace/.resolve-product-dependencies",
  "dependencies": [
    {
      "identity": "datacache",
      "name": "DataCache",
      "url": "https://github.com/huynguyencong/DataCache.git",
      "version": "unspecified",
      "path": "/Users/admin/builder/spi-builder-workspace/.resolve-product-dependencies/.build/checkouts/DataCache",
      "dependencies": [
      ]
    }
  ]
}
Fetching https://github.com/huynguyencong/DataCache.git
[1/445] Fetching datacache
Fetched https://github.com/huynguyencong/DataCache.git from cache (0.86s)
Creating working copy for https://github.com/huynguyencong/DataCache.git
Working copy of https://github.com/huynguyencong/DataCache.git resolved at master (bcb54d3)
warning: '.resolve-product-dependencies': dependency 'datacache' is not used by any target
Found 0 product dependencies
========================================
Build
========================================
Selected platform:         macosSpm
Swift version:             6.0
Building package at path:  $PWD
https://github.com/huynguyencong/DataCache.git
Running build ...
env DEVELOPER_DIR=/Applications/Xcode-16.1.0.app xcrun swift build --arch arm64 -Xswiftc -Xfrontend -Xswiftc -stats-output-dir -Xswiftc -Xfrontend -Xswiftc .stats -Xswiftc -strict-concurrency=complete
Building for debugging...
[0/2] Write sources
[1/2] Write swift-version--7754E27361AE5C74.txt
[3/6] Compiling DataCache Dictionary+Cache.swift
[4/6] Compiling DataCache String+MD5.swift
[5/6] Compiling DataCache DataCache.swift
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:24:23: warning: static property 'instance' is not concurrency-safe because non-'Sendable' type 'DataCache' may have shared mutable state; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
 22 |     static let defaultMaxCachePeriodInSecond: TimeInterval = 60 * 60 * 24 * 7         // a week
 23 |
 24 |     public static let instance = DataCache(name: "default")
    |                       |- warning: static property 'instance' is not concurrency-safe because non-'Sendable' type 'DataCache' may have shared mutable state; this is an error in the Swift 6 language mode
    |                       |- note: annotate 'instance' with '@MainActor' if property should only be accessed from the main actor
    |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 25 |
 26 |     let cachePath: String
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:303:5: warning: non-'@objc' instance method in extensions cannot be overridden; use 'public' instead
301 |      - parameter completionHandler: Called after the operation completes.
302 |      */
303 |     open func cleanExpiredDiskCache(completion handler: (()->())? = nil) {
    |     `- warning: non-'@objc' instance method in extensions cannot be overridden; use 'public' instead
304 |
305 |         // Do things in cocurrent io queue
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:76:16: warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
    :
 74 |     private func writeDataToDisk(data: Data, key: String) {
 75 |         ioQueue.async {
 76 |             if self.fileManager.fileExists(atPath: self.cachePath) == false {
    |                `- warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 77 |                 do {
 78 |                     try self.fileManager.createDirectory(atPath: self.cachePath, withIntermediateDirectories: true, attributes: nil)
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:271:21: warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
    :
269 |         ioQueue.async {
270 |             do {
271 |                 try self.fileManager.removeItem(atPath: self.cachePath(forKey: key))
    |                     `- warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
272 |             } catch {
273 |                 print("DataCache: Error while remove file: \(error.localizedDescription)")
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:285:21: warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
    :
283 |         ioQueue.async {
284 |             do {
285 |                 try self.fileManager.removeItem(atPath: self.cachePath)
    |                     `- warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
286 |             } catch {
287 |                 print("DataCache: Error when clean disk: \(error.localizedDescription)")
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:308:62: warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
    :
306 |         ioQueue.async {
307 |
308 |             var (URLsToDelete, diskCacheSize, cachedFiles) = self.travelCachedFiles(onlyForCacheSize: false)
    |                                                              `- warning: capture of 'self' with non-sendable type 'DataCache' in a `@Sendable` closure; this is an error in the Swift 6 language mode
309 |
310 |             for fileURL in URLsToDelete {
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:356:17: warning: capture of 'handler' with non-sendable type '(() -> ())?' in a `@Sendable` closure; this is an error in the Swift 6 language mode
354 |
355 |             DispatchQueue.main.async(execute: { () -> Void in
356 |                 handler?()
    |                 |- warning: capture of 'handler' with non-sendable type '(() -> ())?' in a `@Sendable` closure; this is an error in the Swift 6 language mode
    |                 `- note: a function type must be marked '@Sendable' to conform to 'Sendable'
357 |             })
358 |         }
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:318:61: warning: implicit capture of 'self' requires that 'DataCache' conforms to `Sendable`; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
    :
316 |             }
317 |
318 |             if self.maxDiskCacheSize > 0 && diskCacheSize > self.maxDiskCacheSize {
    |                                                             `- warning: implicit capture of 'self' requires that 'DataCache' conforms to `Sendable`; this is an error in the Swift 6 language mode
319 |                 let targetSize = self.maxDiskCacheSize / 2
320 |
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:356:17: warning: capture of 'handler' with non-sendable type '(() -> ())?' in a `@Sendable` closure; this is an error in the Swift 6 language mode
354 |
355 |             DispatchQueue.main.async(execute: { () -> Void in
356 |                 handler?()
    |                 |- warning: capture of 'handler' with non-sendable type '(() -> ())?' in a `@Sendable` closure; this is an error in the Swift 6 language mode
    |                 `- note: a function type must be marked '@Sendable' to conform to 'Sendable'
357 |             })
358 |         }
[6/6] Emitting module DataCache
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:24:23: warning: static property 'instance' is not concurrency-safe because non-'Sendable' type 'DataCache' may have shared mutable state; this is an error in the Swift 6 language mode
 17 | }
 18 |
 19 | open class DataCache {
    |            `- note: class 'DataCache' does not conform to the 'Sendable' protocol
 20 |     static let cacheDirectoryPrefix = "com.nch.cache."
 21 |     static let ioQueuePrefix = "com.nch.queue."
 22 |     static let defaultMaxCachePeriodInSecond: TimeInterval = 60 * 60 * 24 * 7         // a week
 23 |
 24 |     public static let instance = DataCache(name: "default")
    |                       |- warning: static property 'instance' is not concurrency-safe because non-'Sendable' type 'DataCache' may have shared mutable state; this is an error in the Swift 6 language mode
    |                       |- note: annotate 'instance' with '@MainActor' if property should only be accessed from the main actor
    |                       `- note: disable concurrency-safety checks if accesses are protected by an external synchronization mechanism
 25 |
 26 |     let cachePath: String
/Users/admin/builder/spi-builder-workspace/Sources/DataCache.swift:303:5: warning: non-'@objc' instance method in extensions cannot be overridden; use 'public' instead
301 |      - parameter completionHandler: Called after the operation completes.
302 |      */
303 |     open func cleanExpiredDiskCache(completion handler: (()->())? = nil) {
    |     `- warning: non-'@objc' instance method in extensions cannot be overridden; use 'public' instead
304 |
305 |         // Do things in cocurrent io queue
Build complete! (9.32s)
Build complete.
{
  "dependencies" : [
  ],
  "manifest_display_name" : "DataCache",
  "name" : "DataCache",
  "path" : "/Users/admin/builder/spi-builder-workspace",
  "platforms" : [
    {
      "name" : "macos",
      "version" : "10.11"
    },
    {
      "name" : "ios",
      "version" : "13.0"
    }
  ],
  "products" : [
    {
      "name" : "DataCache",
      "targets" : [
        "DataCache"
      ],
      "type" : {
        "library" : [
          "automatic"
        ]
      }
    }
  ],
  "targets" : [
    {
      "c99name" : "DataCache",
      "module_type" : "SwiftTarget",
      "name" : "DataCache",
      "path" : "Sources",
      "product_memberships" : [
        "DataCache"
      ],
      "sources" : [
        "DataCache.swift",
        "Dictionary+Cache.swift",
        "String+MD5.swift"
      ],
      "type" : "library"
    }
  ],
  "tools_version" : "5.3"
}
Done.