mcorega / MySqlSwiftNative

MySQL Swift Native Driver
Other
112 stars 45 forks source link

How to install this API #39

Open pongy20 opened 5 years ago

pongy20 commented 5 years ago

Hey,

I am new to Swift and want to use my MySQL Database. I found this Api and it sounds great to connect to my database without creating a PHP File on my Server.

Now the question... how can I exactly install / implement this to my Code? Where can I download it? How to I implement it into Xcode?

Hopefully somebody will see my Issue :) and is ready to take some time and helps me. I'll be very happy :). Please...

tuanbavns commented 5 years ago

same question above??? I dont find anything else

Napoleon-BlownApart commented 5 years ago

I'm not a Swift expert by any means, but I was able to get MySQLSwiftNative working in a fresh (Swift 5.0.1/Xcode 10.2) project I created. I haven't yet tested the full range of the MySQLDriver.framework's features and functions, so there may be some other issues down the road I haven't gotten to.

What I did was: In MySQLSwiftNative 1) Update the MySQLSwiftNative project to use Swift tools version 4 swift package tools-version --set 4.0.0 2) Added meta-data to Package.swift to output a Product and Target. Below is the final version of Package.swift (which includes the result of step 1 above):

`

// swift-tools-version:4.0
import PackageDescription

let package = Package(
    name: "MySQLDriver",
    products: [
        .library(name: "MySQLDriver", targets: ["MySQLDriver"])
    ],
    dependencies: [
    ],
    targets: [
        .target(name: "MySQLDriver", path: "Sources"),
    ]
)

3) Added public to the declarations of create (twice) in the Table.swift file. (This step may not be quite right, but it quickly fixed a scope issue.)

In my new project 4) Added a stanza to the new project's Package.swift file to indicate the dependency on 'MySQLDriver':

`

dependencies: [
  .package(
    path: "/Users/user/Programming/MySQL/MySqlSwiftNative"
  )
],

5) and updated my project's target to also depend on "MySQLDriver". 6) Ran swift package generate-xcodeproj inside my project's root folder. 7) Since my project has a main.swift file, I copied the sample code from the MySQLSampleOSX/main.swift file into my main.swift, added import MySQLDriver at the beginning and built/ran my project.

pongy20 commented 5 years ago

Thank you very much !!! <3

zebatista commented 4 years ago

Hello, My experience is in VB.NET, I moved to Mac now. I am trying to learn Xcode and Swift and I would also like to be able to install it. But I am in a lot of difficulties. I needed more details on the installation. Someone available to help? Thank you in advance!