'List' is ambiguous for type lookup in this context
emin-grbo opened this issue · comments
There seems to be a collision for the List type, whenever I use it I get the following error.
Maybe I am missing some simple solution to this?
I know that if there is a name collision with other types you could say Twift.List
, but here, all List types seem to be from Twift, but registered as different?
Do advise :) Thank you!
@daneden So this is weird.
If I omit SwiftUI from the import and add UIKit, it builds fine. It seems it is clashing with native List method in SwiftUI.
Not sure what is a solution to this?
Rename it to TwiftList?
@roblack ah yep, this is a tough one API-design-wise. I ran into this early in development and figured the ambiguity was easy enough to work around either by:
- Disambiguating in-line (e.g.
let list: Twift.List
) - Disambiguating via typealias (e.g.
typealias TwitterList = Twift.List
I don’t love the idea of prefixing List
since that would make it inconsistent compared to the rest of the API, but open to other ideas!
I tried to use Twift.List but it did not work...however, i did that with SwiftUI being imported so that might have something to do with it 🤷♂️
I will try with a typealias, that should do the trick 🤞
But you are right, prefixing would cause inconsistency 👌
Will report back first thing, but after that i think i can just close/cancel the PR
Actually, this turned out to be 👌
I do not need SwiftUI in the ObservedObject and View does not need to know the type of object so it all works out :)
It is weird that typealias or Twift.List
did not work as soon as SwiftUI is imported but, main thing is that there are ways around it 🙌