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

Example os import usage for Swift 5/4 #283

Closed
jimisaacs opened this issue Mar 26, 2019 · 9 comments
Closed

Example os import usage for Swift 5/4 #283

jimisaacs opened this issue Mar 26, 2019 · 9 comments

Comments

@jimisaacs
Copy link

I might be doing something wrong, or missed some docs, but after upgrading to 10.2, the Result enum can't be found. I think I'm doing something wrong, and would like to just ask for some direction, and maybe a doc callout for proper import usage.

@NachoSoto
Copy link
Contributor

If you’re building with 10.2, there’s little point to using this dependency anymore :)

@mdiep
Copy link
Contributor

mdiep commented Mar 26, 2019

It should work just as before. Can you share what you're doing and what error you're seeing?

@jimisaacs
Copy link
Author

Screen Shot 2019-03-26 at 1 00 00 PM

@jimisaacs
Copy link
Author

@NachoSoto can you clarify? If I'm still supporting iOS 11, or still have dependencies that build for Swift 4.2? Do I need this dependency? Sorry if I'm not completely up to speed on all things upgrade, just giving it a shot to see what breaks.

@NachoSoto
Copy link
Contributor

NachoSoto commented Mar 26, 2019

Result is part of the Swift standard library that you’re including with your binary. As long as you’re compiling with a newer version of the compiler, you have access to Result, regardless of iOS / dependencies Swift versions.

@jimisaacs
Copy link
Author

jimisaacs commented Mar 26, 2019

@NachoSoto Ok, so I think the issue there is a namespace one, and particularly with Apollo. Let me share the full imports.
Screen Shot 2019-03-26 at 1 14 54 PM

Apollo defines it's own Result, and I had a conflict that was more easily resolved by doing the targeted import on Result (less to import).

Now for me to remove Result. I'd have to do the following (among many other options).

  1. Remove Result
  2. Change all references to Swift.Result.

Of course other options are, make a PR against Apollo, but we have other issues there that complicate that route.

Does this outline sound like the right approach? Or from what I've shared, should importing Result the way I am still work?

@mdiep
Copy link
Contributor

mdiep commented Mar 26, 2019

Oh, in Swift 5 mode, this repo doesn't define Result as an enum—it just extends the type from the Standard library. You can probably remove that import entirely or change it to import Result and it should work.

import enum Result.Result will no longer work because, as it says, the Result module no longer defines that enum.

@jimisaacs
Copy link
Author

Hmm, ok, it looks like I can't get around doing the targeted import on Apollo then. thanks for the help!

@jimisaacs
Copy link
Author

Just following up, targeted import on Apollo and removal of import of Result works.

@mdiep mdiep closed this as completed Mar 26, 2019
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

3 participants