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

Protocol-defined APIs marked with @discardableResult don't propagate to implementations #713

Closed
palpatim opened this issue Aug 13, 2020 · 5 comments
Labels
bug Something isn't working core Amplify Core components pending-release Code has been merged but pending release Code has been merged but pending release
Milestone

Comments

@palpatim
Copy link
Member

Thanks for adding this ! After I updated my project to 1.1.0, removing derived data and cleaning the build, I still receive the 'unsused' warning. What do I miss ?

image

I am sure I have the correct version :

    @discardableResult
    func signIn(username: String?,
                password: String?,
                options: AuthSignInOperation.Request.Options?,
                listener: AuthSignInOperation.ResultListener?) -> AuthSignInOperation

Originally posted by @sebsto in #633 (comment)

@palpatim
Copy link
Member Author

As noted in https://bugs.swift.org/browse/SR-7186, this is actually expected behavior in Swift, which I neglected to validate down the call chain. :( Will fix.

@palpatim palpatim added bug Something isn't working core Amplify Core components labels Aug 13, 2020
@palpatim palpatim added this to the 1.1.1 milestone Aug 13, 2020
palpatim added a commit that referenced this issue Aug 17, 2020
@palpatim palpatim added the pending-release Code has been merged but pending release Code has been merged but pending release label Aug 17, 2020
palpatim added a commit that referenced this issue Aug 17, 2020
* chore: Fix bugs in README-combine-support sample code
* chore: Upgrade SwiftLint, fix linting errors

refs:#713
@palpatim
Copy link
Member Author

@sebsto
Copy link

sebsto commented Aug 19, 2020

Thanks for addressing this.
Looks like Amplify.Hub.listendid not wen through
https://github.com/aws-amplify/amplify-ios/blob/main/Amplify/Categories/Hub/HubCategoryBehavior.swift#L26 and related implementations

@palpatim
Copy link
Member Author

That's intentional--Hub APIs don't return an AmplifyOperation, they return a cancellation token, similar to what Publisher.sink() does. The Combine flavor of Hub is Hub.publisher(for:), but as with other Combine flavored APIs, the result of accessing the publisher is not discardable.

@sebsto
Copy link

sebsto commented Aug 19, 2020

Thanks Tim for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Amplify Core components pending-release Code has been merged but pending release Code has been merged but pending release
Projects
None yet
Development

No branches or pull requests

2 participants