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

Generics not detected in framework code #191

Closed
marchy opened this issue Oct 31, 2015 · 6 comments
Closed

Generics not detected in framework code #191

marchy opened this issue Oct 31, 2015 · 6 comments
Assignees

Comments

@marchy
Copy link

marchy commented Oct 31, 2015

I can't seem to get generics working in my framework project which pulls a dependency on Bolts.
The following error keeps coming up while compiling:
”Error:(17, 35) cannot specialize non-generic type 'BFTask'”

I've tried setting the iOS Deployment Target to iOS to ensure generics are supported in the minimum SDK level but still no luck. Any thoughts?

Note this seems to work just fine in the application project, it's only the framework project (which is a seperate .xcworkspace) that has this issue.

@nlutsenko
Copy link
Member

Huh, this is strange, as it should be supported everywhere.
Are you using class-forwarding aka @class BFTask; by any chance?
If yes - please note that forwarding should also include a generic declaration.
Something like @class BFTask<BFGenericType>;

@nlutsenko nlutsenko self-assigned this Nov 2, 2015
@marchy
Copy link
Author

marchy commented Nov 2, 2015

Using pure Swift not Obj-C, so no @Class forwarding involved.

@richardjrossiii
Copy link
Member

Swift and objective-c generics are not compatible with each other, and so generic objective-c types are imported as normal types in swift (you can verify this by looking at NSArray).

@marchy
Copy link
Author

marchy commented Nov 2, 2015

In this case can you please open up the initial request for a Swift library for Bolts here: #61

And what's the team's plans on implementing this?

Kind thanks.

@richardjrossiii
Copy link
Member

The rough answer is 'soon'. We do have eventual plans for it. But trying to come up with an API that allows easy swift & objc interop while maintaining the best feature compatibility between the two languages has proved difficult.

@marchy
Copy link
Author

marchy commented Nov 2, 2015

Thanks for the update Richard. I imagine trying to reconcile both is going to be difficult indeed.

Perhaps maintaining two separate API's, the exiting one and a clean-cut Swift-only API which also supports the new ErrorTypes conventions instead of NSError might be the way to go.

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

3 participants