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

Swift 4 support #668

Merged
merged 19 commits into from
Jul 1, 2017
Merged

Swift 4 support #668

merged 19 commits into from
Jul 1, 2017

Conversation

thebluepotato
Copy link
Contributor

What changes:

  • Replaces import CSQLite with the new import SQLite3 directly exposed to Swift code.
  • Updates the project to Swift 4.0, with recommended warning and a slightly edited map syntax regarding tuples.
  • All the .modulemap files have been removed since they are no longer necessary.

The aim of this PR is to have code that compiles without issues with Swift 4/Xcode 9. All tests pass, except for those regarding SQLCipher, which haven't been tested. pod lib lint fails due to errors relating to SQLCipher. My guess is that there needs to be some tweaking on how SQLCipher is imported in Swift now that there's a native access to the SQLite API.

" ".join([
return " ".join(clauses.join.map { arg in
let (type, query, condition) = arg
return " ".join([
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the issue in #664 : the map closure take one tuple argument instead of its components. That's new in Swift 4, see SE-0110.

@jberkel
Copy link
Collaborator

jberkel commented Jun 16, 2017

Thanks for getting the ball rolling. Hope travis will release a new Xcode image soon.

eoinkelly and others added 5 commits June 17, 2017 08:41
The old way shown causes a build error in swift 3 (XCode8):

  Ambiguous reference to member 'print(_:separator:terminator:)'
Fix demonstration of how to trace SQL statements in docs
@thebluepotato
Copy link
Contributor Author

So actually Travis succeeds, the only fails are in the validator schemes where there's some kind of timeout. The same commit has succeeded in Travis for my own branch : https://travis-ci.org/thebluepotato/SQLite.swift/builds/248984684.
I think we could merge into the swift 4 branch.

@abunur
Copy link

abunur commented Jul 1, 2017

I updated my Podfile as such:
pod 'SQLite.swift', :git => 'https://github.com/stephencelis/SQLite.swift.git', :branch => 'swift-4'
but I am still getting that error 'sys/_symbol_aliasing.h' file not found

any thoughts?

thanks

@thebluepotato
Copy link
Contributor Author

thebluepotato commented Jul 1, 2017

@abunur Well that's because the swift-4 branch hasn't been updated yet. That's why there's this pull request. We just need someone with write access to merge the PR.
In the meantime, use pod 'SQLite.swift, :git => 'https://github.com/thebluepotato/SQLite.swift.git', :branch => 'swift-4'
Btw, I forgot to mention that the Travis builds now work because there is an Xcode 9 image now.

@abunur
Copy link

abunur commented Jul 1, 2017

@thebluepotato lol my bad sorry :)

@abunur
Copy link

abunur commented Jul 1, 2017

@thebluepotato so after switching to your branch, doing a pod install --repo-update
and an option-clean in Xcode, I am still getting the same error. Any other steps I need to do? Running Xcode 9 Beta 2.

@thebluepotato
Copy link
Contributor Author

@abunur I've tried switching to the latest release, pod update, build (the error showed up) then switching back to my branch, pod update and build (no error).
I'd suggest making sure that your Podfile is correct, saved before pod update and if the error still shows up, deintegrate Cocoapods using pod deintegrate or pod superdeintegrate and finally running pod installagain.

@jberkel
Copy link
Collaborator

jberkel commented Jul 1, 2017

@thebluepotato thanks! looks like there aren't any massive changes in swift4. and the simulator test instability bug is back...

@thebluepotato
Copy link
Contributor Author

@jberkel Indeed, when I closed and reopened the PR yesterday to trigger a rebuild, Travis worked completely but merging the most recent commit from mastertriggered another build which did fail here on the PR but worked on my branch...
Indeed, Swift 4 introduces mostly incremental changes. It's designed to be mostly source code compatible with Swift 3. The new stricter difference between single-tuple and multiple arguments is one of the changes that needed some adjustment.

@jberkel jberkel merged commit 6463eb1 into stephencelis:swift-4 Jul 1, 2017
@thebluepotato thebluepotato deleted the swift-4 branch July 2, 2017 15:59
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

Successfully merging this pull request may close these issues.

5 participants