ibm bluemix - Overriding init method in Swift for Objective-C class with naming conflict -


i trying subclass ibmdataobject mobile data sdk on bluemix. ibmdata framework in written in objective-c, init method trying override, looks this:

- (instancetype)initwithclass:(nsstring *)classname; 

using in swift, gets converted to:

init!(withclass classname: string!) {     super.init(withclass: classname) } 

this must conflict naming convention check in swift, because error:

enter image description here

having word class in init method name seems cause issue because auto-fix deletes withclass , puts in keyword class.

i not sure if there workaround this, maybe warning suppression? or ibmdataobject init method need change it's name?

i faced same error, fixed changing override method with:

required override init() {     super.init(withclass: "item") } 

since init method required receive string argument. <<(nsstring *)classname;>>

also changed init method to:

init(classname: string){     super.init(withclass: classname) } 

hope helps.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -