Friday, 15 June 2012

ios - Swift : Type XXX must conform to protocol 'NSObjectProtocol' -



ios - Swift : Type XXX must conform to protocol 'NSObjectProtocol' -

i trying implement swift class must

inherit objective-c class implement objective-c protocol class variable.

although objective-c class subclassing inheriting nsobject, receive next compilation error :

type ddbitem must conform protocol 'nsobjectprotocol'

the objective-c class , objective-c protocol inheriting / implementing available @ https://github.com/aws/aws-sdk-ios/blob/master/dynamodb/awsdynamodbobjectmapper.h

awsdynamodbmodel has long chain of inheritance starts nsobject awsdynamodbmodeling enforcing 2 class variables.

my code

class ddbitem : awsdynamodbmodel, awsdynamodbmodeling { // class var dynamodbtablename : string { { homecoming "" }} // class var hashkeyattribute : string { { homecoming "" }} class func dynamodbtablename() -> string! { homecoming "" } class func hashkeyattribute() -> string! { homecoming "" } }

bonus question : when trying implement objective-c protocol mandated class variables swift class variables, receive compilation error :

type ddbitem must conform protocol 'awsdynamodbmodeling'

implementing them function seems accepted. why ?

just inherit nsobject:

class ddbitem : nsobject, awsdynamodbmodel, awsdynamodbmodeling {

ios objective-c swift amazon-dynamodb

No comments:

Post a Comment