BoltsFramework / Bolts-ObjC

Bolts is a collection of low-level libraries designed to make developing mobile apps easier.
Other
5.64k stars 577 forks source link

Create separate API using Swift generics #61

Closed marchy closed 8 years ago

marchy commented 10 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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

ileacristian commented 9 years ago

Any updates?

willadsen commented 9 years ago

+1

danyalaytekin commented 9 years ago

+1

nlutsenko commented 9 years ago

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 commented 9 years ago

@nlutsenko Thanks for the update Nikita. Exciting stuff!

marchy commented 9 years ago

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 commented 9 years ago

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 commented 9 years ago

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 commented 8 years ago

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: https://github.com/BoltsFramework/Bolts-iOS/issues/191

nlutsenko commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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!