Skip to content

Commit 3b35592

Browse files
committed
Add Claude Code configuration and update dependencies for Ruby 3.4 compatibility
1 parent d2b601e commit 3b35592

File tree

4 files changed

+223
-47
lines changed

4 files changed

+223
-47
lines changed

.claude/settings.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(swift build:*)",
5+
"Bash(swift package:*)",
6+
"Bash(swift test:*)",
7+
"Bash(xcodebuild:*)",
8+
"Bash(xcrun simctl:*)",
9+
"Bash(bundle exec fastlane:*)",
10+
"Bash(bundle install)",
11+
"Bash(bundle update:*)",
12+
"Bash(gem list:*)",
13+
"Bash(gem search:*)",
14+
"Bash(swiftlint:*)",
15+
"Bash(swiftformat:*)",
16+
"Bash(git status:*)",
17+
"Bash(git diff:*)",
18+
"Bash(git log:*)",
19+
"Bash(git branch:*)",
20+
"Bash(git add:*)",
21+
"Bash(git commit:*)",
22+
"Bash(git stash:*)"
23+
]
24+
}
25+
}

CLAUDE.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Repository Overview
6+
7+
PubNub Swift Chat SDK - A Swift wrapper providing idiomatic iOS/macOS/tvOS APIs for real-time chat functionality. The SDK wraps the Kotlin Multiplatform (KMP) Chat SDK core via the `PubNubChat` dependency.
8+
9+
**Requirements:** iOS 14+, macOS 11+, tvOS 14+, Xcode 15+, Swift 5+
10+
11+
## Build Commands
12+
13+
```bash
14+
# Build with Swift Package Manager
15+
swift build
16+
17+
# Build with Xcode
18+
xcodebuild -workspace PubNubSwiftChatSDK.xcworkspace -scheme PubNubSwiftChatSDK build
19+
20+
# Resolve package dependencies
21+
swift package resolve
22+
```
23+
24+
## Testing
25+
26+
Tests are integration tests that require PubNub API keys.
27+
28+
### Running Tests Locally
29+
30+
1. Configure test credentials in `Tests/PubNubSwiftChatSDKTests.plist`:
31+
```xml
32+
<key>publishKey</key>
33+
<string>YOUR_PUBLISH_KEY</string>
34+
<key>subscribeKey</key>
35+
<string>YOUR_SUBSCRIBE_KEY</string>
36+
```
37+
38+
2. Run tests:
39+
```bash
40+
# Via Xcode (recommended)
41+
xcodebuild test -workspace PubNubSwiftChatSDK.xcworkspace \
42+
-scheme PubNubSwiftChatSDK \
43+
-destination 'platform=iOS Simulator,name=iPhone 15'
44+
45+
# Via fastlane (requires Ruby/Bundler and env vars)
46+
export SDK_PUB_KEY="your_key"
47+
export SDK_SUB_KEY="your_key"
48+
bundle exec fastlane test --env ios
49+
```
50+
51+
### Test Schemes
52+
53+
- `PubNubSwiftChatSDK` - Main SDK scheme
54+
- `PubNubSwiftChatSDKTests` - Closure-based integration tests
55+
- `PubNubSwiftChatSDKAsyncTests` - Async/await integration tests
56+
57+
## Linting
58+
59+
```bash
60+
swiftlint
61+
```
62+
63+
Configuration in `.swiftlint.yml` - line length 150, includes Sources/ and Tests/.
64+
65+
## Documentation Snippets
66+
67+
`Snippets/` contains compilable code examples used in PubNub documentation. These are validated during CI/CD to ensure customer-facing docs remain accurate.
68+
69+
**When modifying public APIs**, update corresponding snippets to prevent build failures.
70+
71+
## Architecture
72+
73+
### Dependency Chain
74+
75+
```
76+
PubNubSwiftChatSDK (this repo)
77+
└── PubNubChat (KMP compiled for Swift) - core implementation
78+
└── PubNubSDK (Swift SDK) - low-level PubNub APIs
79+
```
80+
81+
### Source Structure
82+
83+
- **`Sources/Chat/`** - Main entry point
84+
- `Chat.swift` - Protocol defining all chat operations
85+
- `ChatImpl.swift` - Implementation wrapping KMP `PubNubChat.ChatImpl`
86+
- `ChatConfiguration.swift` - SDK configuration options
87+
88+
- **`Sources/Entities/`** - Domain objects (each has protocol + impl + async extension)
89+
- `Channel`, `User`, `Message`, `Membership`, `ThreadChannel`, `ThreadMessage`, `ChannelGroup`
90+
- Pattern: `Entity.swift` (protocol) + `EntityImpl.swift` (KMP wrapper) + `Entity+AsyncAwait.swift`
91+
92+
- **`Sources/MessageDraft/`** - Message composition with mentions/references
93+
94+
- **`Sources/Extensions/`** - Type conversions between Swift and KMP types
95+
96+
- **`Sources/Models/`** - Data transfer objects (`Event`, `EventContent`, `File`, etc.)
97+
98+
### Key Patterns
99+
100+
1. **Protocol + Implementation**: Each entity has a public protocol (e.g., `Channel`) and internal implementation (e.g., `ChannelImpl`) that wraps the KMP type
101+
102+
2. **Dual API Surface**: All async operations have both:
103+
- Closure-based: `func getUser(userId:completion:)`
104+
- Async/await: `func getUser(userId:) async throws -> User`
105+
106+
3. **KMP Bridge**: `ChatImpl` creates the KMP core via `ChatImpl.createKMPChat()` and all entity implementations hold references to both the KMP object and the parent `ChatImpl`
107+
108+
4. **Stream Handling**: Real-time updates return `AutoCloseable` - callers must retain strong reference to continue receiving updates
109+
110+
### Entity Ownership
111+
112+
All entities hold a strong reference to `Chat`:
113+
```swift
114+
// ChannelImpl.swift
115+
let chat: ChatImpl
116+
let channel: PubNubChat.Channel_ // KMP type
117+
```
118+
119+
## Test Structure
120+
121+
- `Tests/BaseIntegrationTestCase.swift` - Base class with `chat: ChatImpl` and helpers
122+
- `Tests/AsyncAwait/BaseAsyncIntegrationTestCase.swift` - Async test base class
123+
- `Tests/Common/IntegrationTestCaseConfiguration.swift` - Creates test `ChatImpl` instances
124+
- Entity-specific tests: `ChannelIntegrationTests.swift`, `MessageIntegrationTests.swift`, etc.
125+
126+
## Dependencies
127+
128+
Defined in `Package.swift`:
129+
- `PubNubChat` (kmp-chat) - KMP core, exact version pinned
130+
- `PubNubSDK` (swift) - Low-level SDK, exact version pinned

Gemfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
source "https://rubygems.org"
22

3-
gem "fastlane", '2.225.0'
3+
gem "fastlane", '2.231.0'
4+
gem 'xcpretty', '0.4.1'
45
gem 'rexml', '3.3.9'
6+
7+
# Ruby 3.4+ compatibility - these gems were removed from stdlib
8+
gem 'abbrev'
9+
gem 'mutex_m'
10+
gem 'logger'

Gemfile.lock

Lines changed: 61 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,42 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.7)
5-
base64
6-
nkf
7-
rexml
8-
addressable (2.8.7)
9-
public_suffix (>= 2.0.2, < 7.0)
4+
CFPropertyList (3.0.8)
5+
abbrev (0.1.2)
6+
addressable (2.8.8)
7+
public_suffix (>= 2.0.2, < 8.0)
108
artifactory (3.0.17)
119
atomos (0.1.3)
12-
aws-eventstream (1.3.0)
13-
aws-partitions (1.993.0)
14-
aws-sdk-core (3.211.0)
10+
aws-eventstream (1.4.0)
11+
aws-partitions (1.1206.0)
12+
aws-sdk-core (3.241.4)
1513
aws-eventstream (~> 1, >= 1.3.0)
1614
aws-partitions (~> 1, >= 1.992.0)
1715
aws-sigv4 (~> 1.9)
16+
base64
17+
bigdecimal
1818
jmespath (~> 1, >= 1.6.1)
19-
aws-sdk-kms (1.95.0)
20-
aws-sdk-core (~> 3, >= 3.210.0)
19+
logger
20+
aws-sdk-kms (1.121.0)
21+
aws-sdk-core (~> 3, >= 3.241.4)
2122
aws-sigv4 (~> 1.5)
22-
aws-sdk-s3 (1.169.0)
23-
aws-sdk-core (~> 3, >= 3.210.0)
23+
aws-sdk-s3 (1.212.0)
24+
aws-sdk-core (~> 3, >= 3.241.4)
2425
aws-sdk-kms (~> 1)
2526
aws-sigv4 (~> 1.5)
26-
aws-sigv4 (1.10.1)
27+
aws-sigv4 (1.12.1)
2728
aws-eventstream (~> 1, >= 1.0.2)
2829
babosa (1.0.4)
2930
base64 (0.2.0)
31+
bigdecimal (4.0.1)
3032
claide (1.1.0)
3133
colored (1.2)
3234
colored2 (3.1.2)
3335
commander (4.6.0)
3436
highline (~> 2.0.0)
37+
csv (3.3.5)
3538
declarative (0.0.20)
36-
digest-crc (0.6.5)
39+
digest-crc (0.7.0)
3740
rake (>= 12.0.0, < 14.0.0)
3841
domain_name (0.6.20240107)
3942
dotenv (2.8.1)
@@ -51,32 +54,35 @@ GEM
5154
faraday-rack (~> 1.0)
5255
faraday-retry (~> 1.0)
5356
ruby2_keywords (>= 0.0.4)
54-
faraday-cookie_jar (0.0.7)
57+
faraday-cookie_jar (0.0.8)
5558
faraday (>= 0.8.0)
56-
http-cookie (~> 1.0.0)
59+
http-cookie (>= 1.0.0)
5760
faraday-em_http (1.0.0)
58-
faraday-em_synchrony (1.0.0)
61+
faraday-em_synchrony (1.0.1)
5962
faraday-excon (1.1.0)
6063
faraday-httpclient (1.0.1)
61-
faraday-multipart (1.0.4)
62-
multipart-post (~> 2)
64+
faraday-multipart (1.2.0)
65+
multipart-post (~> 2.0)
6366
faraday-net_http (1.0.2)
6467
faraday-net_http_persistent (1.2.0)
6568
faraday-patron (1.0.0)
6669
faraday-rack (1.0.0)
6770
faraday-retry (1.0.3)
6871
faraday_middleware (1.2.1)
6972
faraday (~> 1.0)
70-
fastimage (2.3.1)
71-
fastlane (2.225.0)
73+
fastimage (2.4.0)
74+
fastlane (2.231.0)
7275
CFPropertyList (>= 2.3, < 4.0.0)
76+
abbrev (~> 0.1.2)
7377
addressable (>= 2.8, < 3.0.0)
7478
artifactory (~> 3.0)
7579
aws-sdk-s3 (~> 1.0)
7680
babosa (>= 1.0.3, < 2.0.0)
77-
bundler (>= 1.12.0, < 3.0.0)
81+
base64 (~> 0.2.0)
82+
bundler (>= 1.17.3, < 5.0.0)
7883
colored (~> 1.2)
7984
commander (~> 4.6)
85+
csv (~> 3.3)
8086
dotenv (>= 2.1.1, < 3.0.0)
8187
emoji_regex (>= 0.1, < 4.0)
8288
excon (>= 0.71.0, < 1.0.0)
@@ -94,9 +100,12 @@ GEM
94100
http-cookie (~> 1.0.5)
95101
json (< 3.0.0)
96102
jwt (>= 2.1.0, < 3)
103+
logger (>= 1.6, < 2.0)
97104
mini_magick (>= 4.9.4, < 5.0.0)
98105
multipart-post (>= 2.0.0, < 3.0.0)
106+
mutex_m (~> 0.3.0)
99107
naturally (~> 2.2)
108+
nkf (~> 0.2.0)
100109
optparse (>= 0.1.1, < 1.0.0)
101110
plist (>= 3.1.0, < 4.0.0)
102111
rubyzip (>= 2.0.0, < 3.0.0)
@@ -108,7 +117,7 @@ GEM
108117
tty-spinner (>= 0.8.0, < 1.0.0)
109118
word_wrap (~> 1.0.0)
110119
xcodeproj (>= 1.13.0, < 2.0.0)
111-
xcpretty (~> 0.3.0)
120+
xcpretty (~> 0.4.1)
112121
xcpretty-travis-formatter (>= 0.0.3, < 2.0.0)
113122
fastlane-sirp (1.0.0)
114123
sysrandom (~> 1.0)
@@ -129,12 +138,12 @@ GEM
129138
google-apis-core (>= 0.11.0, < 2.a)
130139
google-apis-storage_v1 (0.31.0)
131140
google-apis-core (>= 0.11.0, < 2.a)
132-
google-cloud-core (1.7.1)
141+
google-cloud-core (1.8.0)
133142
google-cloud-env (>= 1.0, < 3.a)
134143
google-cloud-errors (~> 1.0)
135144
google-cloud-env (1.6.0)
136145
faraday (>= 0.17.3, < 3.0)
137-
google-cloud-errors (1.4.0)
146+
google-cloud-errors (1.5.0)
138147
google-cloud-storage (1.47.0)
139148
addressable (~> 2.8)
140149
digest-crc (~> 0.4)
@@ -150,39 +159,42 @@ GEM
150159
os (>= 0.9, < 2.0)
151160
signet (>= 0.16, < 2.a)
152161
highline (2.0.3)
153-
http-cookie (1.0.7)
162+
http-cookie (1.0.8)
154163
domain_name (~> 0.5)
155-
httpclient (2.8.3)
164+
httpclient (2.9.0)
165+
mutex_m
156166
jmespath (1.6.2)
157-
json (2.7.2)
158-
jwt (2.9.3)
167+
json (2.18.0)
168+
jwt (2.10.2)
159169
base64
170+
logger (1.7.0)
160171
mini_magick (4.13.2)
161172
mini_mime (1.1.5)
162-
multi_json (1.15.0)
173+
multi_json (1.19.1)
163174
multipart-post (2.4.1)
164-
nanaimo (0.3.0)
165-
naturally (2.2.1)
175+
mutex_m (0.3.0)
176+
nanaimo (0.4.0)
177+
naturally (2.3.0)
166178
nkf (0.2.0)
167-
optparse (0.5.0)
179+
optparse (0.8.1)
168180
os (1.1.4)
169-
plist (3.7.1)
170-
public_suffix (6.0.1)
171-
rake (13.2.1)
181+
plist (3.7.2)
182+
public_suffix (7.0.2)
183+
rake (13.3.1)
172184
representable (3.2.0)
173185
declarative (< 0.1.0)
174186
trailblazer-option (>= 0.1.1, < 0.2.0)
175187
uber (< 0.2.0)
176188
retriable (3.1.2)
177189
rexml (3.3.9)
178-
rouge (2.0.7)
190+
rouge (3.28.0)
179191
ruby2_keywords (0.0.5)
180-
rubyzip (2.3.2)
192+
rubyzip (2.4.1)
181193
security (0.1.5)
182-
signet (0.19.0)
194+
signet (0.21.0)
183195
addressable (~> 2.8)
184196
faraday (>= 0.17.5, < 3.a)
185-
jwt (>= 1.5, < 3.0)
197+
jwt (>= 1.5, < 4.0)
186198
multi_json (~> 1.10)
187199
simctl (1.6.10)
188200
CFPropertyList
@@ -199,15 +211,15 @@ GEM
199211
uber (0.1.0)
200212
unicode-display_width (2.6.0)
201213
word_wrap (1.0.0)
202-
xcodeproj (1.25.1)
214+
xcodeproj (1.27.0)
203215
CFPropertyList (>= 2.3.3, < 4.0)
204216
atomos (~> 0.1.3)
205217
claide (>= 1.0.2, < 2.0)
206218
colored2 (~> 3.1)
207-
nanaimo (~> 0.3.0)
219+
nanaimo (~> 0.4.0)
208220
rexml (>= 3.3.6, < 4.0)
209-
xcpretty (0.3.0)
210-
rouge (~> 2.0.7)
221+
xcpretty (0.4.1)
222+
rouge (~> 3.28.0)
211223
xcpretty-travis-formatter (1.0.1)
212224
xcpretty (~> 0.2, >= 0.0.7)
213225

@@ -216,7 +228,10 @@ PLATFORMS
216228
ruby
217229

218230
DEPENDENCIES
219-
fastlane (= 2.225.0)
231+
abbrev
232+
fastlane (= 2.231.0)
233+
logger
234+
mutex_m
220235
rexml (= 3.3.9)
221236

222237
BUNDLED WITH

0 commit comments

Comments
 (0)