objective c - Swift 2 - @objc Protocol that throws an Error -


i'm using typhoon in swift project requires protocols marked @objc. attempting upgrade project swift 2.

in ios application, service layer throws errors ui. however, despite best efforts, compile error:

type 'errorthrower' not conform protocol 'throwable'

@objc protocol throwable {     func dosomething(someparam:anyobject) throws }  @objc class errorthrower : nsobject, throwable {     func dosomething(someparam: anyobject) throws {         nslog("an error thrown")         throw genericerror.generic     } }  enum genericerror : errortype {     case generic } 

i saw post "swift class not conform objective-c protocol error handling"

so, made me try this:

@objc protocol throwable {     func dosomething(someparam:anyobject) throws }   class errorthrower : nsobject, throwable {          @objc(dosomethingandreturnerror:someparam:)     func dosomething(someparam: anyobject) throws {         nslog("an error thrown")         throw genericerror.generic     } } 

it doesn't complain @objc(...) on implementation, still gives same non-conforming protocol error.

i tried no luck...

@objc protocol throwable {     func dosomethingandreturnerror(error:nserrorpointer, someparam:anyobject) -> bool } 

what's proper way in swift 2 declare protocol @objc , throw error on methods?

unfortunately, researched today, believe swift 2 style exception incompatible objective-c, , therefore not work typhoon.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -