Skip to content

Commit 666c90d

Browse files
committed
fix(swift-sdk): handle integer size values in size-changed notifications
JSON integers are decoded as Int, not Double, but the code was casting to Double which failed silently. Use NSNumber to handle both Int and Double values from the JSON decoder.
1 parent 93bd3b7 commit 666c90d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

swift/Sources/McpApps/AppBridge.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ public actor AppBridge {
107107
isInitialized = true
108108
onInitialized?()
109109
case "ui/notifications/size-changed":
110-
let width = notification.params?["width"]?.value as? Int
111-
let height = notification.params?["height"]?.value as? Int
110+
// Handle both Int and Double from JSON (integers decode as Int, not Double)
111+
let width = (notification.params?["width"]?.value as? NSNumber)?.intValue
112+
let height = (notification.params?["height"]?.value as? NSNumber)?.intValue
112113
onSizeChange?(width, height)
113114
case "notifications/message":
114115
if let level = notification.params?["level"]?.value as? String,

0 commit comments

Comments
 (0)