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

@import SwiftyDropboxObjC creates errors with Bridging headers. #425

Open
chrisvanbuskirk opened this issue Jul 7, 2024 · 5 comments
Open

Comments

@chrisvanbuskirk
Copy link

chrisvanbuskirk commented Jul 7, 2024

I imported SwiftyDropbox into my project via SPM. Migrating from dropbox-sdk-obj-c and made necessary code changes, which worked.

It will work fine until you include a header file importing SwiftyDropboxObjC in a bridging header.

@import SwiftyDropboxObjC <- module not found

If the plan is deprecate dropbox-sdk-obj-c it would be ideal to fix this to work with hybrid objc/swift projects. I haven't tried it in cocoapods which is not a solution I want.

I've included a sample project.
dropbox.zip

@greg-db
Copy link
Contributor

greg-db commented Jul 8, 2024

Thanks for writing this up and submitting a sample project! I'll ask the team to look into this.

@julianlocke
Copy link
Contributor

I suspect effectively importing SwiftyDropboxObjC in the bridging header is causing some circularity when generating the bridging header, failing there. I don't immediately see anything I can do to alleviate this from our side.

I think you will need some kind of workaround on your side. Instead of importing SwiftyDropboxObjC in ViewController.h, you can forward declare the needed type, i.e., @class DBXDropboxClient; there, then import SwiftyDropboxObjC in the ViewController.m file.

The consequence will be that you won't be able to access ViewController._dbxClient from Swift code, you'll need some workaround. That could be: continue using a SwiftyDropboxObjC client and wrap it in your own type(s) or functions on ViewController and call that/those from Swift, or it could be to write an api layer in @objc-compatible Swift around a SwiftyDropbox client.

@chrisvanbuskirk
Copy link
Author

@julianlocke thank you for the detailed response. I can try the suggested workaround. Fortunately the client is in a manager which doing all the work. I will try it out.

@chrisvanbuskirk
Copy link
Author

chrisvanbuskirk commented Jul 12, 2024

@julianlocke the work around works just fine. In my testing so far of adopting SwiftyDropbox I've noticed that downloadWithPath does not call its progress block. However, uploadDataWithPath does indeed call its progress block.

@greg-db
Copy link
Contributor

greg-db commented Jul 12, 2024

@chrisvanbuskirk Thanks for the note! I'll ask the team to look into that as well.

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