You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to SE-0033, attribute((swift_wrapper(enum))) and attribute((swift_wrapper(struct))) Objective-C types should be transparently bridged to Swift and back. However, attempting to override Objective-C methods and properties that contain nullable "string enum" parameters or return values results in a "type cannot be represented in Objective-C" error:
typedefNSString * UIActivityTypeNS_EXTENSIBLE_STRING_ENUM;
@interface UIActivity : NSObject@property(nonatomic, readonly, nullable) UIActivityTypeactivityType;
// more declarations…@endclassCopyActivity: UIActivity {
// Property cannot be an @objc override because its type cannot be represented in Objective-C// '@objc' getter for non-'@objc' property// adding '@nonobjc' fixes the error, but the method isn't called at runtimeoverridevaractivityType: UIActivityType? {
returnUIActivityType("com.example.Copy")
}
// overriding with a non-optional worksoverridevaractivityType: UIActivityType {
returnUIActivityType("com.example.Copy")
}
}
Environment
Xcode 8.0 beta 6 (8S201h)
Additional Detail from JIRA
md5: aaf7ef6e6f9c50f435ac1314f3009bb6
Issue Description:
According to SE-0033,
attribute((swift_wrapper(enum)))
andattribute((swift_wrapper(struct)))
Objective-C types should be transparently bridged to Swift and back. However, attempting to override Objective-C methods and properties that contain nullable "string enum" parameters or return values results in a "type cannot be represented in Objective-C" error:SE-0033: https://github.com/apple/swift-evolution/blob/master/proposals/0033-import-objc-constants.md
The text was updated successfully, but these errors were encountered: