I'm in the process of learning Swift coding and decided to attempt a porting of one of my existing Windows programs.
The thing is, that program relies heavily on connecting to a remote MySQL server.

I've seen a few attempts to provide various connectors to an assortment of databases, including MySQL.
Most solutions say that it can be done using a bridge to Object C, but none really show how.

Does anyone here have any experience in connecting a Cocoa/Swift application to a MySQL server (or any remote database at all)?

2 Years
Discussion Span
Last Post by Tim_11

Is this a mobile app? If it is you can use sqlite instead, it is supported pretty well in objective c so I guess Swift is the same (haven't got around to updating my iOS knowledge base yet).
Otherwise, if you need to connect to a remote MySQL serve you may have to add another layer, a PHP webservice or similar, that the app connects to and that passes the requests on to the database.
Then you just need to pass info back and forth as JSON and you shouldn't have any issues.


I know that I could use a webservice if this was for iOS (or a webapplication!).
But because I said that I'm porting a Windows program, I would think that it was obvious. Appearently not.
This is for OSX Mavericks and Yosemite, not iOS.

The whole point of creating a program with a database backend, local or remote, is to not have to use webservices.

And while I'm asking.
Is there such a thing as an equivalent of DataSets/DataTables in Cocoa/Swift to make things easier?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.