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

Create separate API using Swift generics #61

Closed
marchy opened this issue Sep 25, 2014 · 15 comments
Closed

Create separate API using Swift generics #61

marchy opened this issue Sep 25, 2014 · 15 comments
Assignees

Comments

@marchy
Copy link

marchy commented Sep 25, 2014

Now that Swift has been released, the API design between Android and iOS should be brought together with the support of generics in Swift.

Swift apps should be able to reference a more modern API that takes advantage of generics for task results and continuations.

For legacy purposes it likely makes sense to keep the Objective-C implementation separate, since Obj-C does not support generics. However Swift codebases should not be held back from leveraging the advantages of generics due to the legacy nature of the Bolts Obj-C library.

@marchy
Copy link
Author

marchy commented Oct 15, 2014

Can you guys give some thoughts as to progress on this? ie: has it started, what the general strategy you are considering is?

NOTE: There's been a fork project that has started this already called Thunderbolts

@nlutsenko
Copy link
Member

Absolutely, as we have generics in Swift - I think we can add support for new mechanics as well as much cleaner and safer! using Swift generics.
I will look into this, but, unfortunately, can't provide any time line...

@marchy
Copy link
Author

marchy commented Oct 17, 2014

Great, thanks for confirming it's a priority. Looking forward to it!

@ileacristian
Copy link

Any updates?

@willadsen
Copy link

+1

1 similar comment
@danyalaytekin
Copy link

+1

@nlutsenko nlutsenko self-assigned this Aug 9, 2015
@nlutsenko
Copy link
Member

Wanted to let you know guys that we are still tracking this, and that we are working on supporting Obj-C generics (and Swift generics as a result) with Bolts.framework very soon.

Stay tuned for updates on this issue...

@marchy
Copy link
Author

marchy commented Aug 10, 2015

@nlutsenko Thanks for the update Nikita. Exciting stuff!

@marchy
Copy link
Author

marchy commented Sep 10, 2015

Hey guys, congrats on the 1.2.2 release which looks like it has. This is a huge deal for Bolts!

One thing though, the documentation on the main page will have to be updated to show the usage of the genericized tasks everywhere. You guys shouldn't shy out on advertising and educating everyone about this large improvement. Please update the documentation so that everyone can be made aware and start adopting it in their codebases!

@nlutsenko
Copy link
Member

Absolutely!
You can also drive this and send some PRs, we would be happy to review them.
I am going to close this issue, since this is done in #136

@marchy
Copy link
Author

marchy commented Sep 10, 2015

Fantastic work guys! I may be able to do that when I get some time to put into this. No promises... but will try. :)

@marchy
Copy link
Author

marchy commented Nov 2, 2015

Can you pease re-open this issue and note the team's plans for implementing it?

It seems generics was not added for Swift only Objective-C, as per this discussion thread: #191

@nlutsenko
Copy link
Member

Hey everyone, we have a full Swift implementation now:
https://github.com/BoltsFramework/Bolts-Swift

It's runtime incompatible, but if anyone wants to take a shot at implementing conversion layer - I will gladly take a look at the Pull Request.

@christianpbrink
Copy link

@nlutsenko I just stumbled on this.

My project is in Swift and uses the Parse SDK, meaning I'm passing around a lot of BFTask<AnyObject> objects. It works, but I would like it if I could type-instantiate BFTask with my various result types.

My understanding is that this isn't currently possible for my project, since (1) I can't use Objective-C's generics features in Swift and (2) the Task type in Bolts-Swift, which is generic, isn't interchangeable with BFTask and so won't work in my code (unless I write the conversion layer you alluded to, but I wouldn't even know where to begin on that).

Do you know a way I can use type-instantiated BFTasks or Tasks in my Swift code that depends on the Parse SDK, without writing that conversion layer? Or perhaps that undertaking shouldn't sound as intimidating as it does?

@nlutsenko
Copy link
Member

This is a good question!
Unfortunately, as of right now, you would need to create a manual conversion layer between BFTask and BoltsSwift.Task.
I also would love to see this eventually being added upstream to BoltsSwift, meaning that PRs are very welcome!

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

No branches or pull requests

6 participants