https://kotlinlang.org logo
#ios
Title
# ios
m

michaelv

01/28/2022, 6:10 AM
Normally when I write tests I test against the interface rather than the implementation. However in Swift because of the PAT’s it seems I can’t do that now? Is it true? I can only test against the implementation now? What is the best practice here?
s

Sam

01/28/2022, 12:39 PM
PAT?
m

michaelv

01/28/2022, 11:35 PM
It’s an acronym for Protocol with associated type. When the protocol has an associated type you’re not able to create a variable of the protocol and can only use the protocol as a generic constraint. https://stackoverflow.com/questions/36348061/protocol-can-only-be-used-as-a-generic-constraint-because-it-has-self-or-associa
it seems even without an associated type you can’t create a variable of the protocol in tests. It’s not a big deal I just wondered if there was a way to do it.