Skip to content

Commit

Permalink
Switch to (temporarily) use main branch of ably-cocoa
Browse files Browse the repository at this point in the history
This allows us to make use of the Swift concurrency enhancements that
have been added on `main`, and to identify any further concurrency
enhancements that still need to be made (in response to any new
concurrency errors that we get as we continue to develop the Chat SDK).
  • Loading branch information
lawrence-forooghian committed Oct 8, 2024
1 parent 620df5a commit c20327a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
6 changes: 3 additions & 3 deletions AblyChat.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"originHash" : "fcc346d6fe86e610ac200cdbbf91c56204df67286546d5079bd9c610ee65953b",
"originHash" : "6a8d15fb1d326ac6e8a40c286c152332146d6f58c73123cb8083f68d483dd728",
"pins" : [
{
"identity" : "ably-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ably/ably-cocoa",
"state" : {
"revision" : "7f639c609e50053abd4590f34333f9472645558a",
"version" : "1.2.33"
"branch" : "main",
"revision" : "ccca241a8a7f08b22a93802161460c843d9b5bf3"
}
},
{
Expand Down
8 changes: 8 additions & 0 deletions Example/AblyChatExample/Mocks/MockRealtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import AblyChat

/// A mock implementation of `RealtimeClientProtocol`. It only exists so that we can construct an instance of `DefaultChatClient` without needing to create a proper `ARTRealtime` instance (which we can’t yet do because we don’t have a method for inserting an API key into the example app). TODO remove this once we start building the example app
final class MockRealtime: NSObject, RealtimeClientProtocol, Sendable {
func request(_: String, path _: String, params _: [String: String]?, body _: Any?, headers _: [String: String]?, callback _: @escaping ARTHTTPPaginatedCallback) throws {
fatalError("Not implemented")
}

var device: ARTLocalDevice {
fatalError("Not implemented")
}
Expand Down Expand Up @@ -32,6 +36,10 @@ final class MockRealtime: NSObject, RealtimeClientProtocol, Sendable {
}

final class Channel: RealtimeChannelProtocol {
var properties: ARTChannelProperties {
fatalError("Not implemented")
}

var state: ARTRealtimeChannelState {
fatalError("Not implemented")
}
Expand Down
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"originHash" : "fcc346d6fe86e610ac200cdbbf91c56204df67286546d5079bd9c610ee65953b",
"originHash" : "db24f2979451a46f504f45d35893eb8501f27488ae70e1412340139a0e7551e2",
"pins" : [
{
"identity" : "ably-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ably/ably-cocoa",
"state" : {
"revision" : "7f639c609e50053abd4590f34333f9472645558a",
"version" : "1.2.33"
"branch" : "main",
"revision" : "ccca241a8a7f08b22a93802161460c843d9b5bf3"
}
},
{
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ let package = Package(
dependencies: [
.package(
url: "https://github.com/ably/ably-cocoa",
from: "1.2.0"
// TODO: Switch back to using a tag (https://github.com/ably-labs/ably-chat-swift/issues/80)
branch: "main"
),
.package(
url: "https://github.com/apple/swift-argument-parser",
Expand Down
9 changes: 3 additions & 6 deletions Sources/AblyChat/AblyCocoaExtensions/Ably+Dependencies.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import Ably

// TODO: remove "@unchecked Sendable" once https://github.com/ably/ably-cocoa/issues/1962 done
extension ARTRealtime: RealtimeClientProtocol {}

// This @retroactive is needed to silence the Swift 6 compiler error "extension declares a conformance of imported type 'ARTRealtimeChannels' to imported protocol 'Sendable'; this will not behave correctly if the owners of 'Ably' introduce this conformance in the future (…) add '@retroactive' to silence this warning". I don’t fully understand the implications of this but don’t really mind since both libraries are in our control.
extension ARTRealtime: RealtimeClientProtocol, @retroactive @unchecked Sendable {}
extension ARTRealtimeChannels: RealtimeChannelsProtocol {}

extension ARTRealtimeChannels: RealtimeChannelsProtocol, @retroactive @unchecked Sendable {}

extension ARTRealtimeChannel: RealtimeChannelProtocol, @retroactive @unchecked Sendable {}
extension ARTRealtimeChannel: RealtimeChannelProtocol {}

0 comments on commit c20327a

Please sign in to comment.