ios - Subclassing NSInputStream, overriding delegate? -


i've made nsinputstream subclass, when gets read actual data following exception.

*** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '*** -setdelegate: defined abstract class.  define -[eventuscore.fileuploadstream setdelegate:]!' 

i unable override the following property of nsstream abstract class:

unowned(unsafe) public var delegate: nsstreamdelegate? 

here class inherits nsinputstream

class inputstream : nsinputstream {      private var currentstatus: nsstreamstatus  = .closed  //    override var delegate: nsstreamdelegate?      weak var delegate: nsstreamdelegate?      override func open() {         self.currentstatus = .open     }      override func close() {         self.currentstatus = .closed     }      override var streamstatus: nsstreamstatus {         return self.currentstatus     }      override var hasbytesavailable: bool {         return self.currentstatus == .open     }      // mark: nsinputstream , cfreadstream abstract method overrides      override func scheduleinrunloop(arunloop: nsrunloop, formode mode: string) {      }      override func removefromrunloop(arunloop: nsrunloop, formode mode: string) {      }  } 

here error getting: enter image description here

what doing wrong? possible @ using swift?

found suitable way override delegate variable

var localdelegate: nsstreamdelegate?  override var delegate: nsstreamdelegate? {     set {         self.localdelegate = newvalue     }     {         return self.localdelegate     } } 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -