From d8cc5eb9002ce5ced7aa899f5d2f5b39beb4d2c0 Mon Sep 17 00:00:00 2001 From: Artyom Degtyarev <47744118+artdfel@users.noreply.github.com> Date: Mon, 2 Sep 2019 11:27:09 +0300 Subject: [PATCH] Added a note on read-only property's setters (#3287) * Added a note on read-only property setters * re-wrote the part of the setter * looked at the Swift protocol explanation * fixed Obj-C name * made things more laconic --- OBJC_INTEROP.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OBJC_INTEROP.md b/OBJC_INTEROP.md index 68b159ca111..e824da01245 100644 --- a/OBJC_INTEROP.md +++ b/OBJC_INTEROP.md @@ -26,7 +26,7 @@ The table below shows how Kotlin concepts are mapped to Swift/Objective-C and vi | `class` | `class` | `@interface` | [note](#name-translation) | | `interface` | `protocol` | `@protocol` | | | `constructor`/`create` | Initializer | Initializer | [note](#initializers) | -| Property | Property | Property | [note](#top-level-functions-and-properties) | +| Property | Property | Property | [note](#top-level-functions-and-properties) [note](#setters)| | Method | Method | Method | [note](#top-level-functions-and-properties) [note](#method-names-translation) | | `@Throws` | `throws` | `error:(NSError**)error` | [note](#errors-and-exceptions) | | Extension | Extension | Category member | [note](#category-members) | @@ -67,6 +67,10 @@ as a Swift extension, because Kotlin has no concept of extension constructors. Kotlin constructors are imported as initializers to Swift/Objective-C. +### Setters + +Writeable Objective-C properties overriding read-only properties of the superclass are represented as `setFoo()` method for the property `foo`. Same goes for a protocol's read-only properties that are implemented as mutable. + ### Top-level functions and properties Top-level Kotlin functions and properties are accessible as members of special classes.