Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
95a5eaa
OK, start of attempt 3
lawrence-forooghian Sep 5, 2025
e925e76
update the implementation approach — alphabetical, don't miss any files
lawrence-forooghian Sep 8, 2025
9728d05
further notes
lawrence-forooghian Sep 8, 2025
c40540d
further updates to notes
lawrence-forooghian Sep 8, 2025
b2212b9
further with comments
lawrence-forooghian Sep 8, 2025
aaf0892
Its first set of things
lawrence-forooghian Sep 8, 2025
44b88b1
After getting it to make some corrections
lawrence-forooghian Sep 8, 2025
477e3c4
Add error handling pattern
lawrence-forooghian Sep 8, 2025
de4c68b
its attempts at fixing ARTAuth
lawrence-forooghian Sep 8, 2025
924b9bb
Give it further rules on access levels
lawrence-forooghian Sep 8, 2025
5f6659e
Get rid of ARTAuth, we'll try again now PRD is updated
lawrence-forooghian Sep 8, 2025
c1c2f4d
Continuing with ARTAuth — again it's got confused about queues
lawrence-forooghian Sep 8, 2025
11f720e
Get header locations in there and ask it to update PRD
lawrence-forooghian Sep 8, 2025
a7fb719
Fix getter in ARTAuthInternal
lawrence-forooghian Sep 8, 2025
8490661
Further progress
lawrence-forooghian Sep 8, 2025
690087d
Further of Batch 1
lawrence-forooghian Sep 8, 2025
ddbb338
Asking it to make some corrections
lawrence-forooghian Sep 8, 2025
2f2a636
Further implementation
lawrence-forooghian Sep 8, 2025
2d57370
Further
lawrence-forooghian Sep 8, 2025
cf18f06
phase 2 done
lawrence-forooghian Sep 9, 2025
41a9e70
Started batch 3
lawrence-forooghian Sep 9, 2025
8674327
Another file
lawrence-forooghian Sep 9, 2025
aa21071
Further
lawrence-forooghian Sep 9, 2025
14f4c73
Next lot
lawrence-forooghian Sep 9, 2025
f7abd21
TODO remove — add a Claude command
lawrence-forooghian Sep 9, 2025
68e3b12
Further
lawrence-forooghian Sep 9, 2025
f43a62a
Add forgotten ARTEncoder
lawrence-forooghian Sep 9, 2025
aea7997
Further
lawrence-forooghian Sep 9, 2025
7a5620e
Migrate some of the message types
lawrence-forooghian Sep 9, 2025
db4bb25
Next lot
lawrence-forooghian Sep 9, 2025
3a4972e
Further
lawrence-forooghian Sep 9, 2025
b24ecef
Further
lawrence-forooghian Sep 9, 2025
2fb46c0
Further
lawrence-forooghian Sep 9, 2025
d376567
Further
lawrence-forooghian Sep 9, 2025
bc16afa
Further
lawrence-forooghian Sep 9, 2025
9dc472a
further
lawrence-forooghian Sep 9, 2025
8f90a43
Further
lawrence-forooghian Sep 9, 2025
8a40258
Another file done
lawrence-forooghian Sep 9, 2025
9a036bb
Fix up some warnings by hand
lawrence-forooghian Sep 9, 2025
b765fc1
Get rid of logExceptionReportingUrl
lawrence-forooghian Sep 9, 2025
aefe9ac
Further
lawrence-forooghian Sep 9, 2025
7d5b7f9
Further
lawrence-forooghian Sep 9, 2025
e84322f
Further
lawrence-forooghian Sep 9, 2025
2b7c987
Further
lawrence-forooghian Sep 9, 2025
0090092
Further
lawrence-forooghian Sep 9, 2025
7eb39ba
Further — but there's a build failure
lawrence-forooghian Sep 9, 2025
37eef61
Getting it to fix errors from previous commit
lawrence-forooghian Sep 9, 2025
f353aa4
Fix a few transport-related compilation errors by hand
lawrence-forooghian Sep 9, 2025
b6fb405
wip remove some websocket-related placeholders
lawrence-forooghian Sep 9, 2025
618221e
Migrate ARTStats
lawrence-forooghian Sep 9, 2025
0ba01ab
TODO incorporate into groundwork — don't refer to ARTInternalLog in SR
lawrence-forooghian Sep 9, 2025
9f4a6a0
fix the creation of the WebSocket
lawrence-forooghian Sep 9, 2025
a8e7165
Its first attempt at ARTRest — going to revert this though
lawrence-forooghian Sep 9, 2025
19a07f2
Revert "Temporarily remove the docs workflow"
lawrence-forooghian Sep 9, 2025
4721224
The end of its ARTRest work
lawrence-forooghian Sep 11, 2025
1770c98
OK, it's addressed some feedback on ARTRest
lawrence-forooghian Sep 11, 2025
1a44b09
Its first attempt at some more REST stuff — have questions though
lawrence-forooghian Sep 11, 2025
b70dab5
Neuter the ARTPresence class
lawrence-forooghian Sep 11, 2025
f588ec7
Fix its creation of a fallback object, and get it to update PRD
lawrence-forooghian Sep 11, 2025
e1a9b0f
Fix protocols put in wrong place in 1a44b09
lawrence-forooghian Sep 11, 2025
17fca5e
Fix a couple of warnings
lawrence-forooghian Sep 11, 2025
62c04f4
the start of its migration of ARTRealtime.swift
lawrence-forooghian Sep 11, 2025
533d08a
Asked it to convert some things to use `throws`
lawrence-forooghian Sep 11, 2025
cd83321
Asked it to get rid of the inout error stuff that it generated
lawrence-forooghian Sep 11, 2025
793c4a2
ARTRealtimeChannels migration
lawrence-forooghian Sep 11, 2025
d9a055c
Migrate annotations
lawrence-forooghian Sep 11, 2025
6c58ded
wip ARTRealtimePresence; it's gone awry in a bunch of ways thoughj
lawrence-forooghian Sep 11, 2025
92f3bfa
Revert "wip ARTRealtimePresence; it's gone awry in a bunch of ways th…
lawrence-forooghian Sep 11, 2025
7f5c225
Pull in a bunch of callback types that it didn't migrate correctly
lawrence-forooghian Sep 11, 2025
f7e1962
WIP manually sorting out the placeholders that have accumulated
lawrence-forooghian Sep 11, 2025
340ee8d
further
lawrence-forooghian Sep 11, 2025
a9909a8
Explain what to do with ARTErrorCode and ARTState values
lawrence-forooghian Sep 11, 2025
a39f609
Further fixing of placeholders
lawrence-forooghian Sep 11, 2025
2cfbc2e
Remove a placeholder and dodgily use the thing it migrated
lawrence-forooghian Sep 11, 2025
d696a32
Reapply "wip ARTRealtimePresence; it's gone awry in a bunch of ways t…
lawrence-forooghian Sep 11, 2025
da9c5d2
make presence history throwing
lawrence-forooghian Sep 11, 2025
7595919
Get rid of most of internals of presence so we can try again
lawrence-forooghian Sep 11, 2025
6ff44bc
fixup presence history throwing
lawrence-forooghian Sep 11, 2025
b009551
got it to do the instance variables of ARTRealtimePresenceInternal
lawrence-forooghian Sep 11, 2025
c0fbd7e
its first attempt at re-implementing presence
lawrence-forooghian Sep 11, 2025
7b11b74
disable the tests that expect exceptions to be thrown
lawrence-forooghian Sep 11, 2025
14bd4f2
got it to fix some presence issues
lawrence-forooghian Sep 11, 2025
4f5562f
OK, I believe that ARTRealtimePresence is done now
lawrence-forooghian Sep 11, 2025
7645e94
Start migrating realtime channel
lawrence-forooghian Sep 11, 2025
6b07920
Update comments in placeholders
lawrence-forooghian Sep 11, 2025
61dc014
Add the needed properties of realtime channel
lawrence-forooghian Sep 11, 2025
17cb3ae
OK, got the channel initializer in place
lawrence-forooghian Sep 11, 2025
2079e73
its first pass at migrating channel
lawrence-forooghian Sep 11, 2025
2fbc94c
further
lawrence-forooghian Sep 11, 2025
96815fd
furtehr
lawrence-forooghian Sep 11, 2025
49ba662
fixing compilation errors in RealtimeChannel
lawrence-forooghian Sep 11, 2025
49650c0
Finished migrating ARTRealtimeChannel
lawrence-forooghian Sep 11, 2025
d2cf52e
Migrate the properties of ARTRealtimeInternal
lawrence-forooghian Sep 11, 2025
c221fca
my rejigging
lawrence-forooghian Sep 11, 2025
26261a9
delete placeholders, getting ready for implementing ARTRealtimeIntern…
lawrence-forooghian Sep 11, 2025
c204c66
its first attempt at migrating ARTRealtime
lawrence-forooghian Sep 12, 2025
d297638
revisiting its attempts at fixing ARTRealtimeInternal
lawrence-forooghian Sep 15, 2025
1b3c312
Remove use of error pointer in realtime stats
lawrence-forooghian Sep 15, 2025
4fcd8b1
its attempt at migrating ARTJsonLikeEncoder — have not checked
lawrence-forooghian Sep 15, 2025
4c81458
WIP Update tests to import AblySwift
lawrence-forooghian Sep 15, 2025
dfb76ca
wip
lawrence-forooghian Sep 15, 2025
753094a
TODO undo — comment out the log messages in ARTJsonLikeEncoder.swift
lawrence-forooghian Sep 15, 2025
447defd
wip fixing its attempt at ARTJsonLikeEnocder
lawrence-forooghian Sep 15, 2025
2930966
fixed a bunch of stuff by hand
lawrence-forooghian Sep 15, 2025
37b7a6b
OK, working on getting tests to compile
lawrence-forooghian Sep 15, 2025
c2f8561
further getting tests to compile
lawrence-forooghian Sep 15, 2025
cc9d0bc
furtehr
lawrence-forooghian Sep 15, 2025
e0987bf
furtehr
lawrence-forooghian Sep 15, 2025
12042a4
further
lawrence-forooghian Sep 15, 2025
94977c6
furtehr
lawrence-forooghian Sep 15, 2025
0b7f387
further
lawrence-forooghian Sep 15, 2025
546bd81
further
lawrence-forooghian Sep 15, 2025
bc04f75
further
lawrence-forooghian Sep 15, 2025
8bb4e4f
furtehr
lawrence-forooghian Sep 15, 2025
5045a98
further
lawrence-forooghian Sep 15, 2025
6be1916
further
lawrence-forooghian Sep 15, 2025
60fca47
furter
lawrence-forooghian Sep 15, 2025
76d73e4
further
lawrence-forooghian Sep 15, 2025
165c7bc
furtjre
lawrence-forooghian Sep 15, 2025
6c27bc6
furtehr
lawrence-forooghian Sep 15, 2025
c3c4e7e
furterh
lawrence-forooghian Sep 15, 2025
958220c
TODO RESTORE — comment out a bunch of tests to see if can et anything to
lawrence-forooghian Sep 15, 2025
0680a7e
fix a crash at start of test suite
lawrence-forooghian Sep 15, 2025
ef01ae5
Some further attempts to get some tests to run
lawrence-forooghian Sep 15, 2025
f23c658
Fix a couple of test issues
lawrence-forooghian Sep 16, 2025
99d7df3
got Claude to migrate some tests that used KVC
lawrence-forooghian Sep 16, 2025
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
1 change: 1 addition & 0 deletions .claude/commands/continue-swift-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Continue implementing the plan described in @ably-cocoa-swift-migration-prd.md.
51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docs Generation

on:
pull_request:
push:
branches:
- main
tags:
- '*'

jobs:
build:
runs-on: macos-15

permissions:
deployments: write
id-token: write

steps:
- uses: actions/checkout@v2

- name: Select Specific Xcode Version (16.4)
run: |
sudo xcode-select -s /Applications/Xcode_16.4.app
echo "Selected Xcode version:"
xcodebuild -version

- name: Install Dependencies
run: |
make submodules
bundle install

- name: Build Documentation
run: |
./Scripts/jazzy.sh
ls -al Docs/jazzy

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: eu-west-2
role-to-assume: arn:aws:iam::${{ secrets.ABLY_AWS_ACCOUNT_ID_SDK }}:role/ably-sdk-builds-ably-cocoa
role-session-name: "${{ github.run_id }}-${{ github.run_number }}"

- name: Upload Documentation
uses: ably/sdk-upload-action@v1
with:
sourcePath: Docs/jazzy
githubToken: ${{ secrets.GITHUB_TOKEN }}
artifactName: jazzydoc

72 changes: 72 additions & 0 deletions .swiftpm/xcode/xcshareddata/xcschemes/AblySwift.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AblySwift"
BuildableName = "AblySwift"
BlueprintName = "AblySwift"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:Test/Ably.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "AblySwift"
BuildableName = "AblySwift"
BlueprintName = "AblySwift"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let package = Package(
.testTarget(
name: "AblyTests",
dependencies: [
"Ably",
"AblySwift",
"AblyTesting",
"AblyTestingObjC",
.product(name: "Nimble", package: "nimble"),
Expand All @@ -85,6 +85,7 @@ let package = Package(
]
),
// A handful of tests written in Objective-C (they can't be part of AblyTests because SPM doesn't allow mixed-language targets).
/*
.testTarget(
name: "AblyTestsObjC",
dependencies: [
Expand All @@ -94,11 +95,12 @@ let package = Package(
],
path: "Test/AblyTestsObjC"
),
*/
// Provides test helpers used by both AblyTests and AblyTestsObjC.
.target(
name: "AblyTesting",
dependencies: [
"Ably",
"AblySwift",
],
path: "Test/AblyTesting"
),
Expand Down
220 changes: 220 additions & 0 deletions Sources/AblySwift/ARTAnnotation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
import Foundation

// swift-migration: original location ARTTypes.h, line 9
/// Enumerates the possible values of the `action` field of an `ARTAnnotation`
public enum ARTAnnotationAction: UInt, Sendable {
/// A created annotation.
case create = 0
/// A deleted annotation.
case delete = 1
}

// swift-migration: original location ARTAnnotation.h, line 21
/// :nodoc:
func ARTAnnotationActionToStr(_ action: ARTAnnotationAction) -> String {
switch action {
case .create:
return "Create" // 0
case .delete:
return "Delete" // 1
}
}

// swift-migration: original location ARTAnnotation.h, line 26 and ARTAnnotation.m, line 8
public class ARTAnnotation: NSObject, NSCopying, @unchecked Sendable {

// swift-migration: original location ARTAnnotation.h, line 29
/// A Unique ID assigned by Ably to this message.
public let id: String?

// swift-migration: original location ARTAnnotation.h, line 32
/// The action, whether this is an annotation being added or removed, one of the `ARTAnnotationAction` enum values.
public let action: ARTAnnotationAction

// swift-migration: original location ARTAnnotation.h, line 35
/// The client ID of the publisher of this message.
public let clientId: String?

// swift-migration: original location ARTAnnotation.h, line 38
/// The name of this annotation. This is the field that most annotation aggregations will operate on. For example, using "distinct.v1" aggregation (specified in the type), the message summary will show a list of clients who have published an annotation with each distinct annotation.name.
public let name: String?

// swift-migration: original location ARTAnnotation.h, line 41
/// An optional count, only relevant to certain aggregation methods, see aggregation methods documentation for more info.
public let count: NSNumber?

// swift-migration: original location ARTAnnotation.h, line 44
/// The message payload, if provided.
public let data: Any?

// swift-migration: original location ARTAnnotation.h, line 47
/// This is typically empty, as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute contains the remaining transformations not applied to the `data` payload.
public let encoding: String?

// swift-migration: original location ARTAnnotation.h, line 50
/// Timestamp of when the message was received by Ably, as a `NSDate` object.
public let timestamp: Date?

// swift-migration: original location ARTAnnotation.h, line 53
/// This annotation's unique serial (lexicographically totally ordered).
public let serial: String

// swift-migration: original location ARTAnnotation.h, line 56
/// The serial of the message (of type `MESSAGE_CREATE`) that this annotation is annotating.
public let messageSerial: String

// swift-migration: original location ARTAnnotation.h, line 59
/// The type of annotation it is, typically some identifier together with an aggregation method; for example: "emoji:distinct.v1". Handled opaquely by the SDK and validated serverside.
public let type: String

// swift-migration: original location ARTAnnotation.h, line 62
/// A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads.
public let extras: ARTJsonCompatible?

// swift-migration: original location ARTAnnotation.h, line 64 and ARTAnnotation.m, line 10
public init(
id annotationId: String?,
action: ARTAnnotationAction,
clientId: String?,
name: String?,
count: NSNumber?,
data: Any?,
encoding: String?,
timestamp: Date,
serial: String,
messageSerial: String,
type: String,
extras: ARTJsonCompatible?
) {
self.id = annotationId
self.action = action
self.clientId = clientId
self.name = name
self.count = count
self.data = data
self.encoding = encoding
self.timestamp = timestamp
self.serial = serial
self.messageSerial = messageSerial
self.type = type
self.extras = extras
super.init()
}

// swift-migration: original location ARTAnnotation.m, line 39
public override var description: String {
var description = super.description
let endIndex = description.index(description.endIndex, offsetBy: -2)
if description.count > 2 {
description = String(description[..<endIndex])
}
description += ",\n"
description += " id: \(String(describing: self.id)),\n"
description += " action: \(ARTAnnotationActionToStr(self.action))\n"
description += " clientId: \(String(describing: self.clientId)),\n"
description += " name: \(String(describing: self.name))\n"
description += " count: \(String(describing: self.count))\n"
description += " data: \(String(describing: self.data))\n"
description += " encoding: \(String(describing: self.encoding)),\n"
description += " timestamp: \(String(describing: self.timestamp)),\n"
description += " serial: \(String(describing: self.serial))\n"
description += " messageSerial: \(String(describing: self.messageSerial))\n"
description += " type: \(String(describing: self.type))\n"
description += " extras: \(String(describing: self.extras))\n"
description += "}"
return description
}

// swift-migration: original location NSCopying protocol and ARTAnnotation.m, line 59
public func copy(with zone: NSZone? = nil) -> Any {
let annotation = ARTAnnotation(
id: self.id,
action: self.action,
clientId: self.clientId,
name: self.name,
count: self.count,
data: self.data,
encoding: self.encoding,
timestamp: self.timestamp ?? Date(),
serial: self.serial,
messageSerial: self.messageSerial,
type: self.type,
extras: self.extras
)
return annotation
}

// swift-migration: original location ARTAnnotation+Private.h, line 11 and ARTAnnotation.m, line 76
internal func decode(with encoder: ARTDataEncoder) throws -> ARTAnnotation {
let decoded = encoder.decode(self.data, encoding: self.encoding)
if let errorInfo = decoded.errorInfo {
throw NSError(
domain: ARTAblyErrorDomain,
code: errorInfo.code,
userInfo: [
NSLocalizedDescriptionKey: "decoding failed",
NSLocalizedFailureReasonErrorKey: errorInfo.message
]
)
}
let ret = self.copy() as! ARTAnnotation
return ARTAnnotation(
id: ret.id,
action: ret.action,
clientId: ret.clientId,
name: ret.name,
count: ret.count,
data: decoded.data,
encoding: decoded.encoding,
timestamp: ret.timestamp ?? Date(),
serial: ret.serial,
messageSerial: ret.messageSerial,
type: ret.type,
extras: ret.extras
)
}

// swift-migration: original location ARTAnnotation+Private.h, line 12 and ARTAnnotation.m, line 88
internal func encode(with encoder: ARTDataEncoder) throws -> ARTAnnotation {
let encoded = encoder.encode(self.data)
if let errorInfo = encoded.errorInfo {
throw NSError(
domain: ARTAblyErrorDomain,
code: 0,
userInfo: [
NSLocalizedDescriptionKey: "encoding failed",
NSLocalizedFailureReasonErrorKey: errorInfo.message
]
)
}
let ret = self.copy() as! ARTAnnotation
let newEncoding = NSString.artAddEncoding(encoded.encoding, toString: self.encoding)
return ARTAnnotation(
id: ret.id,
action: ret.action,
clientId: ret.clientId,
name: ret.name,
count: ret.count,
data: encoded.data,
encoding: newEncoding,
timestamp: ret.timestamp ?? Date(),
serial: ret.serial,
messageSerial: ret.messageSerial,
type: ret.type,
extras: ret.extras
)
}
}

// swift-migration: original location ARTAnnotation.m, line 114
extension ARTEvent {
// swift-migration: original location ARTAnnotation.m, line 116
convenience init(annotationType type: String) {
self.init(string: "ARTAnnotation:\(type)")
}

// swift-migration: original location ARTAnnotation.m, line 120
class func new(withAnnotationType type: String) -> ARTEvent {
return ARTEvent(annotationType: type)
}
}
Loading
Loading