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

Matrix Swift Build Error #457

Closed
expertalex opened this issue Feb 23, 2018 · 3 comments
Closed

Matrix Swift Build Error #457

expertalex opened this issue Feb 23, 2018 · 3 comments

Comments

@expertalex
Copy link

expertalex commented Feb 23, 2018

When adding Matrix Swift to Swift Project I see 76 Swift Compiler Errors in MXRoom, MXRestClient and MXSession classes extensions:

Cannot convert call result type '(_) -> Void' to expected type '(() -> Void)!'

Cannot convert call result type '(_) -> Void' to expected type 'MXOnBackgroundSyncDone!' (aka 'ImplicitlyUnwrappedOptional<() -> ()>')

For Example this code:

    /**
     Set the topic of the room.
     
     - parameters:
        - topic: the topic to set.
        - completion: A block object called when the operation completes.
        - response: Indicates whether the operation was a success or failure.
     
     - returns: a `MXHTTPOperation` instance.
     */
    @nonobjc @discardableResult func setTopic(_ topic: String, completion: @escaping (_ response: MXResponse<Void>) -> Void) -> MXHTTPOperation {
        return __setTopic(topic, success: currySuccess(completion), failure: curryFailure(completion))
    }

Has the following error:

Cannot convert call result type '(_) -> Void' to expected type '(() -> Void)!'

Why is this happened?

Swift Version 4
Matrix Pods:
# ---------------------------------------------
# Matrix SDK
# ---------------------------------------------
pod 'SwiftMatrixSDK'
# Enable VoIP
pod 'MatrixSDK/JingleCallStack'

@manuroe
Copy link
Contributor

manuroe commented Mar 2, 2018

Swift 4 has broken SwiftMatrixSDK.

This swift layer was brought by the community. The matrix core team runs projects in Obj-C so that maintaining this pod is not in our priorities at the moment.

What I can suggest:

  • downgrade your project to Swift 3. You can achieve this with CocoaPods by adding a .swift-version file next to your Podfile. This text file contains only the string 3.2.
  • or use directly the Obj-C pod, pod MatrixSDK, and skip the Swift refinement layer of SwiftMatrixSDK
  • or try to fix these errors. A PR from the community will be warmly welcomed

@johnflanagan-spok
Copy link
Contributor

There's more discussion about this on issue #393

@manuroe
Copy link
Contributor

manuroe commented Mar 2, 2018

@expertalex, before @johnflanagan-spok's fix appears in an official pod release, you can point to the develop branch of the pod, ie:

pod 'SwiftMatrixSDK', :git => 'https://github.com/matrix-org/matrix-ios-sdk.git', :branch => 'develop'

@manuroe manuroe closed this as completed Mar 12, 2018
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