Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- run: swift run BuildTool lint

# TODO: Restore in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/2 once we've seen what form the LiveObjects spec takes
# TODO: Restore in https://github.com/ably/ably-liveobjects-swift-plugin/issues/2 once we've seen what form the LiveObjects spec takes
#
# spec-coverage:
# runs-on: macos-15
Expand Down Expand Up @@ -254,7 +254,7 @@ jobs:
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-ably-cocoa-liveobjects-plugin
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-ably-liveobjects-swift-plugin
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"

# Upload the generated documentation
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Example:

For the initial stage of development of this plugin, where we need to also iterate heavily on ably-cocoa, I've added ably-cocoa as a Git submodule, which can be found in [`ably-cocoa`](./ably-cocoa). This allows you to edit ably-cocoa from within this repo's Xcode workspace.

Nearer launch, we'll remove this submodule in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/7.
Nearer launch, we'll remove this submodule in https://github.com/ably/ably-liveobjects-swift-plugin/issues/7.

## Release process

Expand All @@ -137,7 +137,7 @@ For each release, the following needs to be done:
- Update the following (we have https://github.com/ably/ably-chat-swift/issues/277 for adding a script to do this):
- the `version` constant in [`Sources/AblyLiveObjects/Version.swift`](Sources/AblyLiveObjects/Version.swift)
- the `from: "…"` in the SPM installation instructions in [`README.md`](README.md)
- Go to [Github releases](https://github.com/ably/ably-cocoa-liveobjects-plugin/releases) and press the `Draft a new release` button. Choose your new branch as a target
- Go to [Github releases](https://github.com/ably/ably-liveobjects-swift-plugin/releases) and press the `Draft a new release` button. Choose your new branch as a target
- Press the `Choose a tag` dropdown and start typing a new tag, Github will suggest the `Create new tag x.x.x on publish` option. After you select it Github will unveil the `Generate release notes` button
- From the newly generated changes remove everything that don't make much sense to the library user
- Copy the final list of changes to the top of the `CHANGELOG.md` file. Modify as necessary to fit the existing format of this file
Expand Down
2 changes: 1 addition & 1 deletion Sources/AblyLiveObjects/Internal/CoreSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal final class DefaultCoreSDK: CoreSDK {
return
}

// TODO: Implement the full spec of RTO15 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/47)
// TODO: Implement the full spec of RTO15 (https://github.com/ably/ably-liveobjects-swift-plugin/issues/47)
try await DefaultInternalPlugin.sendObject(
objectMessages: objectMessages,
channel: channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Foundation

/// This provides the implementation behind ``PublicDefaultLiveCounter``, via internal versions of the ``LiveCounter`` API.
internal final class InternalDefaultLiveCounter: Sendable {
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/3.
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-liveobjects-swift-plugin/issues/3.
private let mutex = NSLock()

private nonisolated(unsafe) var mutableState: MutableState
Expand Down
4 changes: 2 additions & 2 deletions Sources/AblyLiveObjects/Internal/InternalDefaultLiveMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal protocol LiveMapObjectPoolDelegate: AnyObject, Sendable {

/// This provides the implementation behind ``PublicDefaultLiveMap``, via internal versions of the ``LiveMap`` API.
internal final class InternalDefaultLiveMap: Sendable {
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/3.
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-liveobjects-swift-plugin/issues/3.
private let mutex = NSLock()

private nonisolated(unsafe) var mutableState: MutableState
Expand Down Expand Up @@ -905,7 +905,7 @@ internal final class InternalDefaultLiveMap: Sendable {
return .string(string)
}

// TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
// TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
if let json = entry.data?.json {
switch json {
case let .array(array):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Ably

/// This provides the implementation behind ``PublicDefaultRealtimeObjects``, via internal versions of the ``RealtimeObjects`` API.
internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPoolDelegate {
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/3.
// Used for synchronizing access to all of this instance's mutable state. This is a temporary solution just to allow us to implement `Sendable`, and we'll revisit it in https://github.com/ably/ably-liveobjects-swift-plugin/issues/3.
private let mutex = NSLock()

private nonisolated(unsafe) var mutableState: MutableState!
Expand Down Expand Up @@ -168,7 +168,7 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool
}

// RTO11f
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/50)
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-liveobjects-swift-plugin/issues/50)
let timestamp = clock.now
let creationOperation = ObjectCreationHelpers.creationOperationForLiveMap(
entries: entries,
Expand Down Expand Up @@ -213,7 +213,7 @@ internal final class InternalDefaultRealtimeObjects: Sendable, LiveMapObjectPool

// RTO12f

// TODO: This is a stopgap; change to use server time per RTO12f5 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/50)
// TODO: This is a stopgap; change to use server time per RTO12f5 (https://github.com/ably/ably-liveobjects-swift-plugin/issues/50)
let timestamp = clock.now
let creationOperation = ObjectCreationHelpers.creationOperationForLiveCounter(
count: count,
Expand Down
4 changes: 2 additions & 2 deletions Sources/AblyLiveObjects/Internal/InternalLiveMapValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ internal enum InternalLiveMapValue: Sendable, Equatable {
self = .jsonObject(value)
case let .liveMap(publicLiveMap):
guard let publicDefaultLiveMap = publicLiveMap as? PublicDefaultLiveMap else {
// TODO: Try and remove this runtime check and know this type statically, see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/37
// TODO: Try and remove this runtime check and know this type statically, see https://github.com/ably/ably-liveobjects-swift-plugin/issues/37
preconditionFailure("Expected PublicDefaultLiveMap, got \(publicLiveMap)")
}
self = .liveMap(publicDefaultLiveMap.proxied)
case let .liveCounter(publicLiveCounter):
guard let publicDefaultLiveCounter = publicLiveCounter as? PublicDefaultLiveCounter else {
// TODO: Try and remove this runtime check and know this type statically, see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/37
// TODO: Try and remove this runtime check and know this type statically, see https://github.com/ably/ably-liveobjects-swift-plugin/issues/37
preconditionFailure("Expected PublicDefaultLiveCounter, got \(publicLiveCounter)")
}
self = .liveCounter(publicDefaultLiveCounter.proxied)
Expand Down
4 changes: 2 additions & 2 deletions Sources/AblyLiveObjects/Internal/ObjectsPool.swift
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ internal struct ObjectsPool {
case let .counter(counter):
return counter
case .map:
// TODO: Add the ability to statically reason about the type of pool entries in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/36
// TODO: Add the ability to statically reason about the type of pool entries in https://github.com/ably/ably-liveobjects-swift-plugin/issues/36
preconditionFailure("Expected counter object with ID \(creationOperation.objectID) but found map object")
}
}
Expand Down Expand Up @@ -370,7 +370,7 @@ internal struct ObjectsPool {
case let .map(map):
return map
case .counter:
// TODO: Add the ability to statically reason about the type of pool entries in https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/36
// TODO: Add the ability to statically reason about the type of pool entries in https://github.com/ably/ably-liveobjects-swift-plugin/issues/36
preconditionFailure("Expected map object with ID \(creationOperation.objectID) but found counter object")
}
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/AblyLiveObjects/Protocol/ObjectMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal struct ObjectData: Equatable {
internal var bytes: Data? // OD2d
internal var number: NSNumber? // OD2e
internal var string: String? // OD2f
internal var json: JSONObjectOrArray? // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
internal var json: JSONObjectOrArray? // TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
}

internal struct ObjectsMapOp: Equatable {
Expand Down Expand Up @@ -289,7 +289,7 @@ internal extension ObjectData {
}
}

// TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
// TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
if let wireJson = wireObjectData.json {
let jsonValue = try JSONObjectOrArray(jsonString: wireJson)
json = jsonValue
Expand Down Expand Up @@ -340,7 +340,7 @@ internal extension ObjectData {
// OD4c4: A string payload is encoded as a MessagePack string type, and the result is set on the ObjectData.string attribute
// OD4d4: A string payload is represented as a JSON string and set on the ObjectData.string attribute
string: string,
// TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
// TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
json: json?.toJSONString,
)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AblyLiveObjects/Protocol/WireObjectMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ internal struct WireObjectData {
internal var bytes: StringOrData? // OD2d
internal var number: NSNumber? // OD2e
internal var string: String? // OD2f
internal var json: String? // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
internal var json: String? // TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
}

extension WireObjectData: WireObjectCodable {
Expand Down
8 changes: 4 additions & 4 deletions Tests/AblyLiveObjectsTests/InternalDefaultLiveMapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct InternalDefaultLiveMapTests {
#expect(result?.stringValue == "test")
}

// TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
// TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
// Tests when `json` is a JSON array
@Test
func returnsJSONArrayValue() throws {
Expand All @@ -105,7 +105,7 @@ struct InternalDefaultLiveMapTests {
#expect(result?.jsonArrayValue == ["foo"])
}

// TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
// TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
// Tests when `json` is a JSON object
@Test
func returnsJSONObjectValue() throws {
Expand Down Expand Up @@ -412,8 +412,8 @@ struct InternalDefaultLiveMapTests {
"bytes": TestFactories.internalMapEntry(data: ObjectData(bytes: Data([0x01, 0x02, 0x03]))), // RTLM5d2c
"number": TestFactories.internalMapEntry(data: ObjectData(number: NSNumber(value: 42))), // RTLM5d2d
"string": TestFactories.internalMapEntry(data: ObjectData(string: "hello")), // RTLM5d2e
"jsonArray": TestFactories.internalMapEntry(data: ObjectData(json: .array(["foo"]))), // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
"jsonObject": TestFactories.internalMapEntry(data: ObjectData(json: .object(["foo": "bar"]))), // TODO: Needs specification (see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/46)
"jsonArray": TestFactories.internalMapEntry(data: ObjectData(json: .array(["foo"]))), // TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
"jsonObject": TestFactories.internalMapEntry(data: ObjectData(json: .object(["foo": "bar"]))), // TODO: Needs specification (see https://github.com/ably/ably-liveobjects-swift-plugin/issues/46)
"mapRef": TestFactories.internalMapEntry(data: ObjectData(objectId: "map:ref@123")), // RTLM5d2f2
"counterRef": TestFactories.internalMapEntry(data: ObjectData(objectId: "counter:ref@456")), // RTLM5d2f2
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ struct InternalDefaultRealtimeObjectsTests {
#expect(publishedMessage.operation?.action == .known(.mapCreate))
let objectID = try #require(publishedMessage.operation?.objectId)
#expect(objectID.hasPrefix("map:"))
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/50)
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-liveobjects-swift-plugin/issues/50)
#expect(objectID.contains("1754042434000")) // check contains the mock clock's timestamp in milliseconds
#expect(publishedMessage.operation?.map?.entries == [
"stringKey": .init(data: .init(string: "stringValue")),
Expand Down Expand Up @@ -1216,7 +1216,7 @@ struct InternalDefaultRealtimeObjectsTests {
#expect(publishedMessage.operation?.action == .known(.counterCreate))
let objectID = try #require(publishedMessage.operation?.objectId)
#expect(objectID.hasPrefix("counter:"))
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/50)
// TODO: This is a stopgap; change to use server time per RTO11f5 (https://github.com/ably/ably-liveobjects-swift-plugin/issues/50)
#expect(objectID.contains("1754042434000")) // check contains the mock clock's timestamp in milliseconds
#expect(publishedMessage.operation?.counter?.count == 10.5)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct LiveObjectMutableStateTests {

// @specOneOf(2/3) RTLO4b5b - Check we can unsubscribe using the `response` that's passed to the listener, and that when two updates are emitted back-to-back, the unsubscribe in the first listener causes us to not recieve the second update
@available(iOS 17.0.0, tvOS 17.0.0, *)
@Test(.disabled("This doesn't currently work and I don't think it's a priority, nor do I want to dwell on it right now or rush trying to fix it; see https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/28"))
@Test(.disabled("This doesn't currently work and I don't think it's a priority, nor do I want to dwell on it right now or rush trying to fix it; see https://github.com/ably/ably-liveobjects-swift-plugin/issues/28"))
func unsubscribeInsideCallback_backToBackUpdates() async throws {
// Given
let store = MutableStateStore<String>(stored: .init(objectID: "foo"))
Expand Down
6 changes: 3 additions & 3 deletions Tests/AblyLiveObjectsTests/ObjectLifetimesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct ObjectLifetimesTests {
#expect(createdObjects.weakInternalChannel != nil)
#expect(createdObjects.weakInternalRealtimeObjects != nil)

// TODO: test that we can receive events on a LiveObject (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/30)
// TODO: test that we can receive events on a LiveObject (https://github.com/ably/ably-liveobjects-swift-plugin/issues/30)

// Note that after this return we no longer have a reference to createdObjects and thus no longer have a strong reference to our public RealtimeObjects instance
return .init(
Expand Down Expand Up @@ -185,7 +185,7 @@ struct ObjectLifetimesTests {
#expect(createdObjects.weakInternalRealtimeObjects != nil)
#expect(createdObjects.weakInternalLiveObject != nil)

// TODO: test that we can receive events on a LiveObject (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/30)
// TODO: test that we can receive events on a LiveObject (https://github.com/ably/ably-liveobjects-swift-plugin/issues/30)

// Note that after this return we no longer have a reference to createdObjects and thus no longer have a strong reference to our public LiveObject instance
return .init(
Expand Down Expand Up @@ -232,6 +232,6 @@ struct ObjectLifetimesTests {

#expect(objects as AnyObject === objectsAgain as AnyObject)
#expect(root === rootAgain)
// TODO: when we have an easy way of populating the ObjectsPool (i.e. once we have a write API) then also test with a non-root LiveMap and a counter (https://github.com/ably/ably-cocoa-liveobjects-plugin/issues/30)
// TODO: when we have an easy way of populating the ObjectsPool (i.e. once we have a write API) then also test with a non-root LiveMap and a counter (https://github.com/ably/ably-liveobjects-swift-plugin/issues/30)
}
}
Loading