Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use the Result namespace #250

Open
rodrigoruiz opened this issue Sep 17, 2017 · 3 comments
Open

Unable to use the Result namespace #250

rodrigoruiz opened this issue Sep 17, 2017 · 3 comments

Comments

@rodrigoruiz
Copy link

Hi, I have another Result structure in my code and it's conflicting with this one.
How can I use Result.Result for this enum?
I'm getting the error Reference to generic type 'Result' requires arguments in <...> as if it thinking it's the enum, not the namespace.

@smawpaw
Copy link

smawpaw commented Nov 3, 2017

I found a solution that works for my scenario. The issue was actually with importing Alamofire in the same file I was trying to use my own custom Result type.

FWIW, importing Moya in the same file does not cause this conflict. So, as far as I can tell, I think the namespace issue is with Alamofire and the issue may need to be brought up with them.

@rodrigoruiz

I also cannot, for the life of me, figure this out

@lionhylra
Copy link

I have the same problem. I don't want to import Result in every swift file. So I want to make a type alias like this typealias Result = Result.Result, but the compiler just doesn't understand this.

@matcartmill-old
Copy link

FWIW, you can do:

import Alamofire
import enum Result.Result

typealias _Result<T, E: Error> = Result<T, E>

It's ugly, but does provide a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants