Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Scott Brown
4,406 PointsPopulating phpmyadmin database with JSON API using Swift
Is it possible to populate phpmyadmin database or any of the other url database systems with data from a JSON API url with Swift? I was told this would be more efficient in the starting up of the app than always calling from the API. The tutorials I keep seeing for Swift is to just populate it's core database. Is this what I should be doing instead if I am utilizing Swift? I would really appreciate some feedback. Thank you.
3 Answers

Micah Kline
17,831 PointsIn the end its up to you. You could call the API get the data do stuff with the data and send the data back to the database. You could also store the Data in a local database check for new data on start up and only push updates to the off device database when needed. I would recommend a combination of all of the above. Remember that if the App is in the wild then its no longer your data or bandwidth. So don't download every cat image ever created every time your App is started.

Scott Brown
4,406 PointsMuch appreciated. Thanks a lot for your feedback. Do you know where I can look to show me how to utilize an external database with the JSON API in swift?

Micah Kline
17,831 PointsI'll find some information for you when I get a chance. The big component your missing is a backend. If you want to use Php and store information in a Mysql database you need to create a simple or complex Php-Rest-Api.
You package a request send in your data and the response comes back in JSON. Then you use JSON API to parse it and use it. Same goes for the reverse. Swift is just making a http request the backend is talking to the database and sending the response back in this case a JSON format.

Micah Kline
17,831 Pointshttp://blog.agupieware.com/2014/10/networking-in-swift-building-our.html?m=1
I don't know if this is any good but a quick search brought this up.
P.S I'm I'll so I don't know when I'll be able to do more. Let me know if it helped you.

Scott Brown
4,406 PointsThanks! You're the man Micah. Hope you get better soon. I'm going to read through it. It appears to be what I need.