-
Notifications
You must be signed in to change notification settings - Fork 363
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
Support Swift Package Manager #497
Comments
I really would like to see that happening. I tried some approaches using submodules, softlinks and stuff, but neither one was very fruitful and at the end of the day, they would just result in additional maintenance work when the library continues to evolve. I think the only way to get this done properly is to relayout the sources in a way that makes both Xcode and the Swift Package Manager happy. So the actual question is @robbiehanson: Would you object to such a change or not? Although the handling of Swift Values is not optimal yet and there are no facilities for the new technologies, such as Combine and SwiftUI, I still see YapDatabase as the best database library for Swift at this point of time and would love to see it being more widely adopted. |
I have created a proof-of-concept to find out whether there are additional hurdles and as a first start, it looks quite good. Please have a look at https://github.com/mickeyl/SwiftYapDatabase – more details at https://www.vanille.de/blog/2020-spmifying-yapdatabase/. Please don't take this wrong, it's not supposed to be a fork! I'd be glad to remove this repository as soon as upstream got the appropriate treatment to make it usable via SPM. |
@mickeyl I'm also very motivated to have SPM support here. As an experiment I tried migrating my app to the SPM version you've made and it works well, thanks for trying that! I'd like to help out here and it'd be great if we could a little direction especially with regards to the subspecs provided via CocoaPods. I think a direct translation would be to make a new library product per subspec, but that'd mean you'd have to do: import YapDatabase
import YapDatabaseSwift
import YapDatabaseAutoView
import YapDatabaseSecondaryIndex
...etc Not the best, but maybe not the worst? |
@noremac Thanks for your comment. The thing is… I welcome fine granular subprojects, if, and only if, they make a difference with regards to the amount of, say, linked libraries, or when a big lump of code is included. As it stands though, with the exception of the CloudKit-Extension, these extensions are pretty lightweight (often even empty, since they don't contain any additional Swift support), so it seems to be an unnecessary complication to me. That said, I don't have any strong feelings towards this. If we want to name the core library As it stands with the Objective-C open source landscape, there is obviously no general naming consensus yet. Depending on what you consider the usual case, there seem to be two approaches (with variants). Consider a library Foo: a) Name the underlying Objective-C library with a prefix or suffix, e.g. In the light of more and more pure Swift frameworks becoming the norm, I'm somewhat leaning towards a). Any other opinions? |
For XMPPFramework and CocoaLumberjack, the convention there has been to use a Swift suffix for the Swift module (e.g. |
To use the Objective-C package, `import YapDatabase` now. The corresponding YapDatabase.(h|m) has been renamed to YapDatabaseCore.(h|m).
I have renamed the package as discussed. The Objective-C part can now be used via |
@mickeyl Thanks for the SPM support. I am trying to use Yapdatabase in my app but I am getting an issue for the dependency which is pointing to the latest commit for Yapdatabase in the dependency tree. The error is basically related to depending on an unstable-version package ‘swiftyapdatabase’. I found out that this error is because I am using the latest commit or the master branch, instead for a stable package version I would need a version number to mention in my Package.swift file. .package( I don't see a release version/tag in here -https://github.com/mickeyl/SwiftYapDatabase |
@singhmeher32 I tagged it as version 2.9, which seems to be in line with YapDatabase. |
Thanks very much! |
We should support SPM before we add much more swift code. SPM doesn't support mixed language targets so it's probably best to come up with a non-painful way to support SPM now rather than waiting until there's even more swift code to deal with.
The main pain point is exposing the public headers of the C-language code.
The text was updated successfully, but these errors were encountered: