HomeiOS Developmentios - 'NSHashTable' requires that 'any MyCustomProtocolAnyObject' be a category kind

ios – ‘NSHashTable’ requires that ‘any MyCustomProtocolAnyObject’ be a category kind


Curious, why I am getting this error:

enter image description here

If I declare that solely objects can conform to the protocol:

public protocol DayViewStateUpdating: AnyObject {
    func transfer(from oldDate: Date, to newDate: Date)
}

After which making an attempt to instantiate an NSHashTableof that protocol:

non-public var clientsHashTable = NSHashTable<DayViewStateUpdating>.weakObjects()

I am getting the error:

‘NSHashTable’ requires that ‘any DayViewStateUpdating’ be a category kind

However the any DayViewStateUpdating is assured to be a category kind, because it’s declared as AnyObject earlier. Or am I lacking one thing?

Supply code of the file in context: DayViewState

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments