protocols

Why does WebRTC needs ICE protocol to operate?

纵饮孤独 提交于 2021-01-27 13:00:54
问题 As far as I understand, ICE protocol is used for discovering the nodes/devices from the end-user device to "the outside". I don't understand why it's needed. Isn't packet-routing is the responsibility of network devices like routers and switches? They should find the shortest path from the gateway to the end-user device (Actually, routers remembers those routes they previously discovered). Moreover, NAT protocol is used to convert from an "internal ip" to "external ip" and vice-versa. So

Swift: use of 'self' in method call before super.init initializes self compile error

怎甘沉沦 提交于 2020-12-25 01:40:21
问题 I made a custom class that handles audio recording/playback and put a Protocol in that class. I implemented the Protocol in a UIViewController class and called my setDelegate method for my AudioHelper class. I am getting a compile error that has to do with my init() . Not exactly sure how to get rid of the error: use of 'self' in method call 'setupAudioSession' before super.init initializes self override init() { setupAudioSession() super.init() } How do I resolve this error? And why do I

Multiple enum implementing protocols questions

十年热恋 提交于 2020-08-25 09:20:33
问题 I defined enums as confirming to a protocol Eventable: protocol Eventable { var name: String { get } static var all: [Eventable] { get } } enum MyEnum: String, Eventable { case bla = "bla" case blu = "blu" var name: String { return self.rawValue } static var all: [Eventable] { return [ MyEnum.bla, MyEnum.blu ] } } I have other enums like MyEnum also under the form: enum Bla: String, Eventable { } I have two questions: for the enums having a String data type, I would like to avoid duplicating

delete Single Core Data Item from a uicollectionviewCell using a button

蓝咒 提交于 2020-07-23 07:40:11
问题 I am trying to delete a single element of the coreData set using a button inside a collectionviewcell. So the cell has a label with the result of the core data fetch. When I hit the button it should delete the cell making it no longer appear. Also the the core data single set item should be perementley deleted. I have scence this used before in protocols but not using core data.The core data is var itemName. class CustomCell: UICollectionViewCell { @objc func delete() { }} class

delete Single Core Data Item from a uicollectionviewCell using a button

筅森魡賤 提交于 2020-07-23 07:39:19
问题 I am trying to delete a single element of the coreData set using a button inside a collectionviewcell. So the cell has a label with the result of the core data fetch. When I hit the button it should delete the cell making it no longer appear. Also the the core data single set item should be perementley deleted. I have scence this used before in protocols but not using core data.The core data is var itemName. class CustomCell: UICollectionViewCell { @objc func delete() { }} class

delete Single Core Data Item from a uicollectionviewCell using a button

社会主义新天地 提交于 2020-07-23 07:38:46
问题 I am trying to delete a single element of the coreData set using a button inside a collectionviewcell. So the cell has a label with the result of the core data fetch. When I hit the button it should delete the cell making it no longer appear. Also the the core data single set item should be perementley deleted. I have scence this used before in protocols but not using core data.The core data is var itemName. class CustomCell: UICollectionViewCell { @objc func delete() { }} class