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 OpenAIStreamingCompletions, reference 1.0.1 (d89966), with Swift 6.0 for macOS (SPM) on 14 Sep 2024 00:43:38 UTC.

Swift 6 data race errors: 2

Build Command

env DEVELOPER_DIR=/Applications/Xcode-16.0.0-Release.Candidate.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.53.0
Interrupt handler set up.
========================================
Checkout
========================================
Clone URL: https://github.com/nate-parrott/openai-streaming-completions-swift.git
Reference: 1.0.1
Initialized empty Git repository in /Users/admin/builder/spi-builder-workspace/.git/
From https://github.com/nate-parrott/openai-streaming-completions-swift
 * tag               1.0.1      -> FETCH_HEAD
HEAD is now at d89966e oop
Cloned https://github.com/nate-parrott/openai-streaming-completions-swift.git
Revision (git rev-parse @):
d89966e17627731a2627aff053cc0df86d0022fa
SUCCESS checkout https://github.com/nate-parrott/openai-streaming-completions-swift.git at 1.0.1
========================================
Build
========================================
Selected platform:         macosSpm
Swift version:             6.0
Building package at path:  $PWD
https://github.com/nate-parrott/openai-streaming-completions-swift.git
Running build ...
env DEVELOPER_DIR=/Applications/Xcode-16.0.0-Release.Candidate.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-117DEE11B69C53C9.txt
[3/9] Compiling OpenAIStreamingCompletions OpenAI.swift
[4/9] Compiling OpenAIStreamingCompletions EventStreamParser.swift
[5/9] Emitting module OpenAIStreamingCompletions
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/EventSource.swift:76:12: warning: non-final class 'EventSource' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 74 | }
 75 |
 76 | open class EventSource: NSObject, EventSourceProtocol, URLSessionDataDelegate {
    |            `- warning: non-final class 'EventSource' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 77 |     static let DefaultRetryTime = 3000
 78 |
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/EventSource.swift:81:29: warning: stored property 'lastEventId' of 'Sendable'-conforming class 'EventSource' is mutable; this is an error in the Swift 6 language mode
 79 |     public let urlRequest: URLRequest
 80 |     public var url: URL { urlRequest.url! }
 81 |     private(set) public var lastEventId: String?
    |                             `- warning: stored property 'lastEventId' of 'Sendable'-conforming class 'EventSource' is mutable; this is an error in the Swift 6 language mode
 82 |     private(set) public var retryTime = EventSource.DefaultRetryTime
 83 |     private(set) public var headers: [String: String]
[6/9] Compiling OpenAIStreamingCompletions Event.swift
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/Event.swift:87:17: warning: 'scanUpTo(_:into:)' was deprecated in macOS 10.15
 85 |         var key: NSString?, value: NSString?
 86 |         let scanner = Scanner(string: line)
 87 |         scanner.scanUpTo(":", into: &key)
    |                 `- warning: 'scanUpTo(_:into:)' was deprecated in macOS 10.15
 88 |         scanner.scanString(":", into: nil)
 89 |
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/Event.swift:88:17: warning: 'scanString(_:into:)' was deprecated in macOS 10.15
 86 |         let scanner = Scanner(string: line)
 87 |         scanner.scanUpTo(":", into: &key)
 88 |         scanner.scanString(":", into: nil)
    |                 `- warning: 'scanString(_:into:)' was deprecated in macOS 10.15
 89 |
 90 |         for newline in newLineCharacters {
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/Event.swift:91:24: warning: 'scanUpTo(_:into:)' was deprecated in macOS 10.15
 89 |
 90 |         for newline in newLineCharacters {
 91 |             if scanner.scanUpTo(newline, into: &value) {
    |                        `- warning: 'scanUpTo(_:into:)' was deprecated in macOS 10.15
 92 |                 break
 93 |             }
[7/9] Compiling OpenAIStreamingCompletions OpenAI+ChatCompletion.swift
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:97:25: warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 95 |                 for await message in try self.completeChatStreaming(completionRequest) {
 96 |                     DispatchQueue.main.async {
 97 |                         completion.text = message.content
    |                         `- warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 98 |                     }
 99 |                 }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:90:14: note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 88 | }
 89 |
 90 | public class StreamingCompletion: ObservableObject {
    |              `- note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 91 |     public enum Status: Equatable {
 92 |         case loading
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:97:43: warning: capture of 'message' with non-sendable type 'OpenAIAPI.Message' in a `@Sendable` closure; this is an error in the Swift 6 language mode
  2 |
  3 | extension OpenAIAPI {
  4 |     public struct Message: Equatable, Codable, Hashable {
    |                   `- note: consider making struct 'Message' conform to the 'Sendable' protocol
  5 |         public enum Role: String, Equatable, Codable, Hashable {
  6 |             case system
    :
 95 |                 for await message in try self.completeChatStreaming(completionRequest) {
 96 |                     DispatchQueue.main.async {
 97 |                         completion.text = message.content
    |                                           `- warning: capture of 'message' with non-sendable type 'OpenAIAPI.Message' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 98 |                     }
 99 |                 }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:101:21: warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 99 |                 }
100 |                 DispatchQueue.main.async {
101 |                     completion.status = .complete
    |                     `- warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
102 |                 }
103 |             } catch {
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:90:14: note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 88 | }
 89 |
 90 | public class StreamingCompletion: ObservableObject {
    |              `- note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 91 |     public enum Status: Equatable {
 92 |         case loading
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:105:21: warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
103 |             } catch {
104 |                 DispatchQueue.main.async {
105 |                     completion.status = .error
    |                     `- warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
106 |                 }
107 |             }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:90:14: note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 88 | }
 89 |
 90 | public class StreamingCompletion: ObservableObject {
    |              `- note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 91 |     public enum Status: Equatable {
 92 |         case loading
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:81:38: warning: sending 'message' risks causing data races; this is an error in the Swift 6 language mode
 79 |                         message.role = delta.role ?? message.role
 80 |                         message.content += delta.content ?? ""
 81 |                         continuation.yield(message)
    |                                      |- warning: sending 'message' risks causing data races; this is an error in the Swift 6 language mode
    |                                      `- note: task-isolated 'message' is passed as a 'sending' parameter; Uses in callee may race with later task-isolated uses
 82 |                     }
 83 |                 } catch {
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:93:9: warning: task-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race; this is an error in the Swift 6 language mode
 91 |     public func completeChatStreamingWithObservableObject(_ completionRequest: ChatCompletionRequest) throws -> StreamingCompletion {
 92 |         let completion = StreamingCompletion()
 93 |         Task {
    |         `- warning: task-isolated value of type '() async -> ()' passed as a strongly transferred parameter; later accesses could race; this is an error in the Swift 6 language mode
 94 |             do {
 95 |                 for await message in try self.completeChatStreaming(completionRequest) {
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:97:25: warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
 95 |                 for await message in try self.completeChatStreaming(completionRequest) {
 96 |                     DispatchQueue.main.async {
 97 |                         completion.text = message.content
    |                         |- warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
    |                         `- note: task-isolated 'completion' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
 98 |                     }
 99 |                 }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:97:43: warning: sending 'message' risks causing data races; this is an error in the Swift 6 language mode
 95 |                 for await message in try self.completeChatStreaming(completionRequest) {
 96 |                     DispatchQueue.main.async {
 97 |                         completion.text = message.content
    |                                           |- warning: sending 'message' risks causing data races; this is an error in the Swift 6 language mode
    |                                           `- note: task-isolated 'message' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
 98 |                     }
 99 |                 }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:101:21: warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
 99 |                 }
100 |                 DispatchQueue.main.async {
101 |                     completion.status = .complete
    |                     |- warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
    |                     `- note: task-isolated 'completion' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
102 |                 }
103 |             } catch {
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+ChatCompletion.swift:105:21: warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
103 |             } catch {
104 |                 DispatchQueue.main.async {
105 |                     completion.status = .error
    |                     |- warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
    |                     `- note: task-isolated 'completion' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
106 |                 }
107 |             }
[8/9] Compiling OpenAIStreamingCompletions EventSource.swift
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/EventSource.swift:76:12: warning: non-final class 'EventSource' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 74 | }
 75 |
 76 | open class EventSource: NSObject, EventSourceProtocol, URLSessionDataDelegate {
    |            `- warning: non-final class 'EventSource' cannot conform to 'Sendable'; use '@unchecked Sendable'; this is an error in the Swift 6 language mode
 77 |     static let DefaultRetryTime = 3000
 78 |
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/EventSource.swift:81:29: warning: stored property 'lastEventId' of 'Sendable'-conforming class 'EventSource' is mutable; this is an error in the Swift 6 language mode
 79 |     public let urlRequest: URLRequest
 80 |     public var url: URL { urlRequest.url! }
 81 |     private(set) public var lastEventId: String?
    |                             `- warning: stored property 'lastEventId' of 'Sendable'-conforming class 'EventSource' is mutable; this is an error in the Swift 6 language mode
 82 |     private(set) public var retryTime = EventSource.DefaultRetryTime
 83 |     private(set) public var headers: [String: String]
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/EventSource/EventSource.swift:237:35: warning: capture of 'eventHandler' with non-sendable type '(String?, String?, String?) -> Void' in a `@Sendable` closure; this is an error in the Swift 6 language mode
235 |
236 |             if let eventName = event.event, let eventHandler = eventListeners[eventName] {
237 |                 mainQueue.async { eventHandler(event.id, event.event, event.data) }
    |                                   |- warning: capture of 'eventHandler' with non-sendable type '(String?, String?, String?) -> Void' 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'
238 |             }
239 |         }
[9/9] Compiling OpenAIStreamingCompletions OpenAI+TextCompletion.swift
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:52:21: warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 50 |             DispatchQueue.main.async {
 51 |                 if let statusCode, statusCode / 100 == 2 {
 52 |                     completion.status = .complete
    |                     `- warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 53 |                 }
 54 |             }
    :
 88 | }
 89 |
 90 | public class StreamingCompletion: ObservableObject {
    |              `- note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 91 |     public enum Status: Equatable {
 92 |         case loading
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:61:21: warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 59 |             DispatchQueue.main.async {
 60 |                 if let textOpt {
 61 |                     completion.text += textOpt
    |                     `- warning: capture of 'completion' with non-sendable type 'StreamingCompletion' in a `@Sendable` closure; this is an error in the Swift 6 language mode
 62 |                 }
 63 |             }
    :
 88 | }
 89 |
 90 | public class StreamingCompletion: ObservableObject {
    |              `- note: class 'StreamingCompletion' does not conform to the 'Sendable' protocol
 91 |     public enum Status: Equatable {
 92 |         case loading
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:52:21: warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
 50 |             DispatchQueue.main.async {
 51 |                 if let statusCode, statusCode / 100 == 2 {
 52 |                     completion.status = .complete
    |                     |- warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
    |                     `- note: task-isolated 'completion' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
 53 |                 }
 54 |             }
/Users/admin/builder/spi-builder-workspace/Sources/OpenAIStreamingCompletions/OpenAI+TextCompletion.swift:61:21: warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
 59 |             DispatchQueue.main.async {
 60 |                 if let textOpt {
 61 |                     completion.text += textOpt
    |                     |- warning: sending 'completion' risks causing data races; this is an error in the Swift 6 language mode
    |                     `- note: task-isolated 'completion' is captured by a main actor-isolated closure. main actor-isolated uses in closure may race against later nonisolated uses
 62 |                 }
 63 |             }
Build complete! (8.38s)
Build complete.
{
  "dependencies" : [
  ],
  "manifest_display_name" : "OpenAIStreamingCompletions",
  "name" : "OpenAIStreamingCompletions",
  "path" : "/Users/admin/builder/spi-builder-workspace",
  "platforms" : [
    {
      "name" : "ios",
      "version" : "13.0"
    },
    {
      "name" : "macos",
      "version" : "11.0"
    }
  ],
  "products" : [
    {
      "name" : "OpenAIStreamingCompletions",
      "targets" : [
        "OpenAIStreamingCompletions"
      ],
      "type" : {
        "library" : [
          "automatic"
        ]
      }
    }
  ],
  "targets" : [
    {
      "c99name" : "OpenAIStreamingCompletionsTests",
      "module_type" : "SwiftTarget",
      "name" : "OpenAIStreamingCompletionsTests",
      "path" : "Tests/OpenAIStreamingCompletionsTests",
      "sources" : [
        "OpenAIStreamingCompletionsTests.swift"
      ],
      "target_dependencies" : [
        "OpenAIStreamingCompletions"
      ],
      "type" : "test"
    },
    {
      "c99name" : "OpenAIStreamingCompletions",
      "module_type" : "SwiftTarget",
      "name" : "OpenAIStreamingCompletions",
      "path" : "Sources/OpenAIStreamingCompletions",
      "product_memberships" : [
        "OpenAIStreamingCompletions"
      ],
      "sources" : [
        "EventSource/Event.swift",
        "EventSource/EventSource.swift",
        "EventSource/EventStreamParser.swift",
        "OpenAI+ChatCompletion.swift",
        "OpenAI+TextCompletion.swift",
        "OpenAI.swift"
      ],
      "type" : "library"
    }
  ],
  "tools_version" : "5.7"
}
Done.