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

Error when using as a package: Missing required module 'SQLiteSessionExtension' #6

Open
aidaan opened this issue Sep 8, 2024 · 3 comments

Comments

@aidaan
Copy link

aidaan commented Sep 8, 2024

Is it possible to use this repo as a swift package? I've added it to a project, but when I attempt to import it using:

import SQLiteChangesetSync

It gives this error:

Missing required module 'SQLiteSessionExtension'

If I attempt to import this module:

import SQLiteSessionExtension

It gives this error:

No such module 'SQLiteSessionExtension'

I see that this directory SQLiteSessionExtension exists in the project, and that it contains a module map for this module. And this module map includes the single sqlite3session.h header file, which I'm guessing is used to expose the functions that support the sqlite session extension. Does this need to be exposed as a separate target in the Package.swift file?

Tested using Xcode 15.4 and 16.0 beta 6.

@gerdemb
Copy link
Owner

gerdemb commented Sep 9, 2024

The best place to get started is the demo project SQLiteChangesetSyncDemo.

To get started wrap your dbWriter like this

import SQLiteChangesetSync
let changesetRepository = try ChangesetRepository(dbWriter)

and then, modify all database.write() calls to use changesetRepository.commit() instead. You shouldn't need to import SQLiteSessionExtension directly.

@aidaan
Copy link
Author

aidaan commented Sep 10, 2024

Thanks for the reply! I tried exactly this and it didn't work. That's what yielded the errors mentioned above. I added this repo as a swift package to a project, which isn't quite the same setup as the demo project inside this repo. But I'm not an SPM expert so it's possible I integrated it incorrectly. Have you tried using this repo as a swift package from another project?

What you have in this repo is a cool idea, and would be an elegant solution for syncing GDRB data to CloudKit. I appreciate your work posting this and your help in getting it to work for me.

@gerdemb
Copy link
Owner

gerdemb commented Sep 11, 2024

Thanks for your interest in trying this out! You’re actually the first person I know of who’s used this, so it’s understandable that there are some issues.

I remember now that to get it working, you’ll need to manually set the Swift compiler search path. First, clone the SQLiteChangesetSync repository to your local machine. Then, go to your Project > Build Settings > All and set the search path like this:

image

Ideally, this should be handled within the Swift Package itself, but I haven’t yet figured out how to include it. If anyone has insights on how to do this properly, I’d appreciate the feedback.

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

2 participants