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 SwiftChatGPT, reference main (1fd0f1), with Swift 6.0 for macOS (SPM) on 3 Nov 2024 11:05:48 UTC.

Swift 6 data race errors: 3

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/migueldeicaza/SwiftChatGPT.git
Reference: main
Initialized empty Git repository in /Users/admin/builder/spi-builder-workspace/.git/
From https://github.com/migueldeicaza/SwiftChatGPT
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
HEAD is now at 1fd0f18 Assist the user slightly, and handle modern errors that lack a code
Cloned https://github.com/migueldeicaza/SwiftChatGPT.git
Revision (git rev-parse @):
1fd0f18c1ce654fc05714f919004b080e327326e
SUCCESS checkout https://github.com/migueldeicaza/SwiftChatGPT.git at main
========================================
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": "swiftchatgpt",
      "name": "SwiftChatGPT",
      "url": "https://github.com/migueldeicaza/SwiftChatGPT.git",
      "version": "unspecified",
      "path": "/Users/admin/builder/spi-builder-workspace/.resolve-product-dependencies/.build/checkouts/SwiftChatGPT",
      "dependencies": [
      ]
    }
  ]
}
Fetching https://github.com/migueldeicaza/SwiftChatGPT.git
[1/79] Fetching swiftchatgpt
Fetched https://github.com/migueldeicaza/SwiftChatGPT.git from cache (0.65s)
Creating working copy for https://github.com/migueldeicaza/SwiftChatGPT.git
Working copy of https://github.com/migueldeicaza/SwiftChatGPT.git resolved at main (1fd0f18)
warning: '.resolve-product-dependencies': dependency 'swiftchatgpt' 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/migueldeicaza/SwiftChatGPT.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/5] Compiling SwiftChatGPT SwiftChatGPT.swift
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:33:14: warning: non-final class 'ChatGPT' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 31 | }
 32 | /// Access to ChatGPT API from OpenAI
 33 | public class ChatGPT: NSObject, URLSessionDataDelegate {
    |              `- warning: non-final class 'ChatGPT' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 34 |     let defaultSystemMessage = Message(role: "system", content: "You are a helpful assistant.")
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:34:9: warning: stored property 'defaultSystemMessage' of 'Sendable'-conforming class 'ChatGPT' has non-sendable type 'Message'; this is an error in the Swift 6 language mode
 32 | /// Access to ChatGPT API from OpenAI
 33 | public class ChatGPT: NSObject, URLSessionDataDelegate {
 34 |     let defaultSystemMessage = Message(role: "system", content: "You are a helpful assistant.")
    |         `- warning: stored property 'defaultSystemMessage' of 'Sendable'-conforming class 'ChatGPT' has non-sendable type 'Message'; this is an error in the Swift 6 language mode
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
 36 |     let urlSessionConfig: URLSessionConfiguration
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/Model.swift:26:15: note: consider making struct 'Message' conform to the 'Sendable' protocol
24 |
25 | // MARK: - Message
26 | public struct Message: Codable {
   |               `- note: consider making struct 'Message' conform to the 'Sendable' protocol
27 |     public let role: String?
28 |     public let content: String
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:37:9: warning: stored property 'session' of 'Sendable'-conforming class 'ChatGPT' is mutable; this is an error in the Swift 6 language mode
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
 36 |     let urlSessionConfig: URLSessionConfiguration
 37 |     var session: URLSession!
    |         `- warning: stored property 'session' of 'Sendable'-conforming class 'ChatGPT' is mutable; this is an error in the Swift 6 language mode
 38 |     public var key: String
 39 |     var history: [Message] = []
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:84:13: warning: variable 'prompt' was never mutated; consider changing to 'let' constant
 82 |
 83 |     func buildMessageHistory (newPrompt: String) -> [Message] {
 84 |         var prompt = Message(role: "user", content: newPrompt)
    |             `- warning: variable 'prompt' was never mutated; consider changing to 'let' constant
 85 |         var requestMessages: [Message] = [defaultSystemMessage]
 86 |         requestMessages.append(contentsOf: history)
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:132:18: warning: passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language mode
130 |     func processPartialReply<T> (bytes: URLSession.AsyncBytes, _ f: @escaping (Response) -> T, onComplete: @escaping () -> ()) -> AsyncThrowingStream<T,Error> {
131 |         return AsyncThrowingStream (bufferingPolicy: .unbounded) { continuation in
132 |             Task {
    |                  `- warning: passing closure as a 'sending' parameter risks causing data races between code in the current task and concurrent execution of the closure; this is an error in the Swift 6 language mode
133 |                 for try await line in bytes.lines {
134 |                     if line.starts(with: "data: {") {
    :
143 |                     }
144 |                 }
145 |                 onComplete ()
    |                 `- note: closure captures 'onComplete' which is accessible to code in the current task
146 |                 continuation.finish()
147 |             }
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:139:42: warning: value of non-Sendable type 'T' accessed after being transferred; later accesses could race; this is an error in the Swift 6 language mode
137 |
138 |                         if let response = try? decoder.decode(Response.self, from: data) {
139 |                             continuation.yield(f (response))
    |                                          |- warning: value of non-Sendable type 'T' accessed after being transferred; later accesses could race; this is an error in the Swift 6 language mode
    |                                          `- note: access can happen concurrently
140 |                         }
141 |                     } else if line.starts(with: "data: [DONE]") {
[4/5] Emitting module SwiftChatGPT
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:33:14: warning: non-final class 'ChatGPT' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 31 | }
 32 | /// Access to ChatGPT API from OpenAI
 33 | public class ChatGPT: NSObject, URLSessionDataDelegate {
    |              `- warning: non-final class 'ChatGPT' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 34 |     let defaultSystemMessage = Message(role: "system", content: "You are a helpful assistant.")
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:34:9: warning: stored property 'defaultSystemMessage' of 'Sendable'-conforming class 'ChatGPT' has non-sendable type 'Message'; this is an error in the Swift 6 language mode
 32 | /// Access to ChatGPT API from OpenAI
 33 | public class ChatGPT: NSObject, URLSessionDataDelegate {
 34 |     let defaultSystemMessage = Message(role: "system", content: "You are a helpful assistant.")
    |         `- warning: stored property 'defaultSystemMessage' of 'Sendable'-conforming class 'ChatGPT' has non-sendable type 'Message'; this is an error in the Swift 6 language mode
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
 36 |     let urlSessionConfig: URLSessionConfiguration
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/Model.swift:26:15: note: consider making struct 'Message' conform to the 'Sendable' protocol
24 |
25 | // MARK: - Message
26 | public struct Message: Codable {
   |               `- note: consider making struct 'Message' conform to the 'Sendable' protocol
27 |     public let role: String?
28 |     public let content: String
/Users/admin/builder/spi-builder-workspace/Sources/SwiftChatGPT/SwiftChatGPT.swift:37:9: warning: stored property 'session' of 'Sendable'-conforming class 'ChatGPT' is mutable; this is an error in the Swift 6 language mode
 35 |     let openAiApiUrl = URL (string: "https://api.openai.com/v1/chat/completions")!
 36 |     let urlSessionConfig: URLSessionConfiguration
 37 |     var session: URLSession!
    |         `- warning: stored property 'session' of 'Sendable'-conforming class 'ChatGPT' is mutable; this is an error in the Swift 6 language mode
 38 |     public var key: String
 39 |     var history: [Message] = []
[5/5] Compiling SwiftChatGPT Model.swift
Build complete! (6.75s)
Build complete.
{
  "dependencies" : [
  ],
  "manifest_display_name" : "SwiftChatGPT",
  "name" : "SwiftChatGPT",
  "path" : "/Users/admin/builder/spi-builder-workspace",
  "platforms" : [
    {
      "name" : "ios",
      "version" : "16.0"
    },
    {
      "name" : "macos",
      "version" : "12.0"
    },
    {
      "name" : "watchos",
      "version" : "9.0"
    }
  ],
  "products" : [
    {
      "name" : "SwiftChatGPT",
      "targets" : [
        "SwiftChatGPT"
      ],
      "type" : {
        "library" : [
          "automatic"
        ]
      }
    }
  ],
  "targets" : [
    {
      "c99name" : "SwiftChatGPTTests",
      "module_type" : "SwiftTarget",
      "name" : "SwiftChatGPTTests",
      "path" : "Tests/SwiftChatGPTTests",
      "sources" : [
        "SwiftChatGPTTests.swift"
      ],
      "target_dependencies" : [
        "SwiftChatGPT"
      ],
      "type" : "test"
    },
    {
      "c99name" : "SwiftChatGPT",
      "module_type" : "SwiftTarget",
      "name" : "SwiftChatGPT",
      "path" : "Sources/SwiftChatGPT",
      "product_memberships" : [
        "SwiftChatGPT"
      ],
      "sources" : [
        "Model.swift",
        "SwiftChatGPT.swift"
      ],
      "type" : "library"
    }
  ],
  "tools_version" : "5.7"
}
Done.