Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift PureMVC : Does not conform to NSObjectProtocol

I want to manage all location code in one of my Proxy classes. As the class is built from scratch and not built on a UIView or similar class that inherits NSObjectProtocol, it throws an error 'Does not conform to protocol NSObjectProtocol when I am trying to add CLLocationManagerDelegate.

class GeoProxy : Proxy, CLLocationManagerDelegate
{
   var locationManager = CLLocationManager()

   override class var NAME: String { return "GeoProxy" }
}

Any idea, how I get the class to conform without adding all NSObjectProtocol functions?

like image 305
Marcus Kirsch Avatar asked Dec 14 '15 12:12

Marcus Kirsch


1 Answers

Easier way is making Proxy class inherit from NSObject:

class Proxy: NSObject {
}

Then, all subclasses will conform to NSObjectProtocol. In addition, these classes will be compatible with Objective-C code.

like image 174
redent84 Avatar answered Sep 22 '22 02:09

redent84