I'm trying to create filter functionality using Swift. I have many filter types like Location, Skill, etc. So I'm planning to generalize this using a protocol.
protocol FilterProtocol {
var text: String { get set }
var count: String? { get set }
var isSelected: Bool { get set }
}
extension FilterProtocol: Identifiable {
var id: String { text }
}
struct LocationFilter: FilterProtocol {
var text: String
var count: String?
var isSelected: Bool
}
But I am getting error Extension of protocol 'FilterProtocol' cannot have an inheritance clause