Intended for demonstation purposes only.
Swift module maps for unixODBC, which allow you to use the unixODBC C library in your Swift project.
Note - from Swift 4.2 you can pull the unixODBC library directly into your Swift project and will not need to use this repository (you can see an example of this in Swift-Kuery-PostgreSQL).
Add the CunixODBC
package to the dependencies within your application’s Package.swift
file. Substitute "x.x.x"
with the latest CunixODBC
release.
.package(url: "https://github.com/Andrew-Lees11/CunixODBC.git", from: "x.x.x")
Add CunixODBC
to your target's dependencies:
.target(name: "example", dependencies: ["CunixODBC"]),
import CunixODBC
You must have unixODBC installed on your machine:
- MacOS:
brew install unixodbc
- Linux:
apt-get install unixodbc-dev
Since brew doesn't install the files to the expected place you must provide a linker to swift for any project that depends on this:
swift build -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
swift run -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
swift test -Xcc -I/usr/local/Cellar/unixodbc/2.3.7/include
You must add the xcconfig file from this repo to your project. Then generate the project using:
swift package generate-xcodeproj --xcconfig-overrides unixodbc.xcconfig
We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!