novi / mysql-swift

A type safe MySQL client for Swift
MIT License
163 stars 40 forks source link

Not compiling with Swift 4 #57

Closed LinusGeffarth closed 7 years ago

LinusGeffarth commented 7 years ago

I have imported all the files inside "Sources", into my Xcode project.
Xcode's giving me multiple errors:

private var mysql_: UnsafeMutablePointer<MYSQL>? // Use of undeclared type 'MYSQL'

Same for mysql_init, MYSQL_OPT_CONNECT_TIMEOUT, my_bool, mysql_real_connect, MYSQL_OPT_RECONNECT, etc. ...

Am I missing something? Thanks!

novi commented 7 years ago

UnsafeMutablePointer<MYSQL> is used with C mysql header includes. You would use this library via Package Manager and follow Installation of README.md.

LinusGeffarth commented 7 years ago

Ok, I've never used Package Manager, so I thought I might get around it 😄. Will try and report back. Thanks for the quick response!

LinusGeffarth commented 7 years ago

So I installed Swift Package Manager, cd'd into the project directory, ran swift package init, opened and modified the packages.swift file as described in the readme, and ran swift package resolve (resolve is new for fetch). It says "fetching ..." and "cloning..." the urls. Then, I open the project (.xcworkspace, since I'm also using cocoapods) and try to import mysql-swift, but it doesn't know the module.

What am I doing wrong?

novi commented 7 years ago

Use $ swift package generate-xcodeproj for generating Xcode project of your app. Cocoapods or other package manager might be not working together. Note that Swift Package Manager imports mysql-swift automatically. No need import that manually.