In this part of the series we will be looking at how you can access your data using Xcode and then ultimately see your temperature data on your iPhone.
To fully understand this section an understanding of concepts like closures, extensions and working with web data would be very helpful. For this I recommend looking at Apple’s Everyone Can Code materials and specifically the App Development with Swift course. The Apple Book can be accessed here:
The main focus would be Chapter 5, but I would recommend spending some time working through all of the book if you are interested in iOS development.
Jump to the End
If you just want to jump to seeing the app running you can download my project here:
You will need to make one change to the code and that is to point the app to connect to your Pi. To do this open the project in Xcode and look for the TemperatureInfoDataController.swift file. On line 16 you will see the following:
let baseURL = URL(string: "192.168.66.11/temperaturejson.php")!
Now change this line to match your Pi’s address.
Once you build and run the project you should see the latest temperature on the first screen and then using the tab bar you can see all records.
The app is very basic at this point but does give you some idea of what you can improve.
If you would like some further understanding of the project I will make another guide to help break it down a little to help out. In another guide I will also show how to graph the data.