mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
This allows them to be used in generic arguments for NSArray et al. We already do this for the ones that wrap bridged values (like NSString/String), but failed to do it for objects that /weren't/ bridged to Swift values (class instances and protocol compositions), or for Error-which-is-special. In addition to this being a sensible thing to do, /not/ doing this led to IRGen getting very confused (i.e. crashing) when we imported a Objective-C protocol that actually used an NS_TYPED_ENUM in this way. (We actually shouldn't be using Swift's IRGen logic to emit protocol descriptors for imported protocols at all, because it's possible we weren't able to import all the requirements. But that's a separate issue.) https://bugs.swift.org/browse/SR-6844
13 lines
426 B
Objective-C
13 lines
426 B
Objective-C
@import Foundation;
|
|
|
|
typedef NSObject *MyJSONKeyPath __attribute__((swift_wrapper(struct)));
|
|
|
|
@protocol MyJSONSerializing <NSObject>
|
|
@property (copy, readonly, nullable) NSDictionary<NSString *, MyJSONKeyPath> *JSONKeyPathsByPropertyKey NS_SWIFT_NAME(JSONKeyPathsByPropertyKey);
|
|
@end
|
|
|
|
@interface MyJSONAdapter : NSObject
|
|
- (nonnull instancetype)init;
|
|
- (nonnull __kindof id<MyJSONSerializing>)model NS_REFINED_FOR_SWIFT;
|
|
@end
|