0

I am having hard to find how I can create a custom Type can use inside @objc.

enum defined in Objc > Declared in Swift > to be used in Objc

Above looks similar, but I still cannot understand.

For example.

import Foundation ;

typealias T = ()-> Void ;

@objc
protocol A {

     var t : [ String : T ] { get set } ;

}

Property cannot be a member of an @objc protocol because its type cannot be represented in Objective-C

How can I get rid of this error? Do I have to define something in Objective-C? How can I do it? Will be very appreciate if you can give me am example.


The problem look like if you place a custom type inside Dictionary or Array, this error will appear, how can I resolve it?

Micah
  • 4,254
  • 8
  • 30
  • 38
  • This is really far from valid code. `typealias` is misspelt, `Foundation` is not imported, and your declaration of the `var t: T` property is missing the `{ get }` or `{ get set }` qualifier. – Alexander Sep 19 '19 at 03:07
  • apologize, updated. – Micah Sep 19 '19 at 03:09
  • I think that question is an exact match for yours. Let me know if you still have any questions. BTW, though formatting is objective, yours is quite strange (compared to the broader conventions in the Swift community). At least drop the semicolons. They're completely pointless. – Alexander Sep 19 '19 at 04:11

0 Answers0