File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
documentation/cxx-interop Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1261,7 +1261,7 @@ To specify the ownership of returned `SWIFT_SHARED_REFERENCE` types, use the `SW
12611261// Returns +1 ownership; Swift will take responsibility for releasing it.
12621262SharedObject* makeOwnedObject () SWIFT_RETURNS_RETAINED;
12631263
1264- // Returns +0 ownership; the caller must ensure the object stays alive.
1264+ // Returns +0 ownership; the caller must ensure the object stays alive by retaining it before use .
12651265SharedObject* makeUnownedObject () SWIFT_RETURNS_UNRETAINED;
12661266```
12671267
@@ -1271,12 +1271,12 @@ let owned = makeOwnedObject()
12711271owned.doSomething ()
12721272// `owned` is automatically released when it goes out of scope
12731273
1274- let unowned = makeUnownedObject ()
1275- unowned .doSomething ()
1276- // make sure `unowned ` remains valid while in use
1274+ let unOwned = makeUnownedObject ()
1275+ unOwned .doSomething ()
1276+ // Swift makes sure `unOwned ` remains valid while in use by calling an explicit retain operation.
12771277```
12781278
1279- These ownership annotations are also supported in Objective-C or Objective-C ++ functions that return C++ ` SWIFT_SHARED_REFERENCE ` types.
1279+ These ownership annotations are also supported in Objective-C++ functions that return C++ ` SWIFT_SHARED_REFERENCE ` types.
12801280
12811281
12821282### Inheritance and Virtual Member Functions
You can’t perform that action at this time.
0 commit comments