My code below is giving me a warning:
Same-type requirement makes generic parameters ‘Tagger’ and ‘Value’ equivalent; this is an error in Swift 6
While this still works, I’d prefer to get rid of this warning.
I’ve seen cases where removing the Generic solved the issue, but I really need to make it Generic so I can access the ‘tag’ from the protocol ‘Taggable’.
Does anyone know how to fix this?
protocol Taggable: Identifiable {
var tag: Self { get }
}
extension Binding {
func taggable<Tagger: Taggable>() -> Binding<Value> where Value == Tagger {
return Binding(
get: { self.wrappedValue.tag },
set: { self.wrappedValue = $0 }
)
}
}