Skip to content

Commit e951139

Browse files
committed
Update documentation to describe current limitations
1 parent f19c8b0 commit e951139

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Sources/JavaScriptKit/Documentation.docc/Articles/BridgeJS/Exporting-Swift/Exporting-Swift-Protocols.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,20 @@ When you pass a JavaScript object implementing a protocol to Swift:
190190
| Protocol inheritance ||
191191
| Protocol composition: `Protocol1 & Protocol2` ||
192192
| Generics ||
193+
194+
### Type Support for Protocol Method Parameters and Return Types
195+
196+
Protocol method parameters and return values have more limited type support compared to regular exported Swift functions and classes.
197+
198+
**Supported Types:**
199+
- Primitives: `Bool`, `Int`, `Float`, `Double`
200+
- `String`
201+
- `JSObject`
202+
203+
**Not Supported:**
204+
- `@JS class` types
205+
- `@JS enum` types (case, raw value, or associated value)
206+
- `@JS protocol` types
207+
- Optional types: `Int?`, `String?`, etc.
208+
209+
> Note: For regular `@JS func` and `@JS class` exports (not within protocols), all these types including optionals, enums, and classes are fully supported. See <doc:Exporting-Swift-Function> and <doc:Exporting-Swift-Optional> for more information.

0 commit comments

Comments
 (0)