Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class does not conform NSObjectProtocol [duplicate]

Tags:

class

swift

See Why in swift we cannot adopt a protocol without inheritance a class from NSObject?

In short, WCSessionDelegate itself inherits from NSObjectProtocol therefore you need to implement methods in that protocol, too. The easiest way to implement those methods is to subclass NSObject:

class BatteryLevel: NSObject, WCSessionDelegate

Note that you are dealing with Obj-C APIs here.