I have 3 textfield in my application which are the following:
- username
- password
I want to enter this data into the MySQL database using Xcode swift
Do you want to connect MySql Server externally or your local my SQL database
Here is the way using this library https://github.com/novi/mysql-swift
How to make connection
let options = Options(host: "db.example.tokyo"...)
let pool = ConnectionPool(options: options)
let conn = try pool.getConnection()
conn.query("SELECT 1 + 2;")
conn.release()
How to get data from database
let rows: [User] = try pool.execute { conn in
// The connection is held in this block
try conn.query("SELECT * FROM users;") // And also it returns result to outside execute block
}
For more refer the library documentation here
SQLiteorCoreData