I have a situation in an iOS Swift app where the user can "customize the screen" by adding other views and/or changing the view's background color. When they tap save, I want to store the attributes of each object, as well as the parent view's background color to a MySQL database for later retrieval and reconstruction of the views. All data updates are done through PHP REST services.
I'm currently struggling with the color data for the background color. If I print() the color, I get something like "UIDeviceRGBColorSpace 0.866667 0.92549 1 1". I can also convert it to NSData with the following:
let data = NSKeyedArchiver.archivedDataWithRootObject(self.view.backgroundColor!)
However, in either case, I have no idea how to save the data to the database via PHP REST service or even what datatype I would use.
Am I going down the wrong path, altogether? Should I be doing something like grab the RGB values and Alpha and save those to 4 attributes in the database, or get the hex value and store that? Perhaps, there is yet a different approach that would be even more straight forward?