mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When passing value types as a const-ref to a C++ API, ensure that the caller is tasked with handling the lifetime of the instance passed in.
16 lines
342 B
Objective-C
16 lines
342 B
Objective-C
|
|
|
|
@interface NSObject
|
|
@end
|
|
|
|
struct IntWrapper {
|
|
int value;
|
|
IntWrapper() = delete;
|
|
IntWrapper(const int &value): value(value) {};
|
|
};
|
|
|
|
@interface ObjCSwiftBridge : NSObject
|
|
- (instancetype)init __attribute__((unavailable));
|
|
- (instancetype)initWithEmbedded:(const IntWrapper &)embedded __attribute__((objc_designated_initializer));
|
|
@end
|