MariaDB, to PHP, to JSON, to SwiftUI, to CoreData…

It’s been almost a fortnight since my last blog post, but I’ve been pretty busy in the meantime.

Since last time, I’ve been working tirelessly on my own app. I’ve used much that I’ve learned from CodeWithChris and Big Mountain Studio to create the “guts” of an app that can handle fetching a remote JSON file, decoding it, then storing it in CoreData.

I have a slight stumbling block in that I still have difficulty in understanding what SwiftUI will allow you to do and where you can do it and when you can do it in the app. A “declarative” system, whereby everything needs to be present prior to displaying the “View” is quite a difficult concept when you’ve spent many years working with “Procedural” codes, whereby one event follows the next, follows the next, ad infinitum.

The remote “back-end” of the app.

Having got the initial “guts” of the app working, I then spent the last few days working on a “back-end”. This utilises PHP & MariaDB, which is much more familiar ground to me. The purpose of this is to allow me to add data via a web-browser, that is then stored in MariaDB, and the PHP will convert it into JSON ready for my app to retrieve, decode, and store in CoreData.

I’m pleased to say that a lot of it is working out quite nicely so far. For all the stumbling blocks I encounter due to my lack of understanding of SwiftUI principles, there’s a heck of a lot that I do already know and understand.

Until my next blog post, here are some thoughts I threw on Twitter whilst working on all of the above…

Using Core Data with a Picker wheel might not be a lot to many people, but it’s pretty cool to see it working after taking a while to figure it out.

@codeRunnerUK – Jul 4, 2022

Child Entities from Parent Entities, working well. Before I go further with that, I want to look at getting initial data from an external file. Time to see what @BigMtnStudio from has to say about JSON…

@codeRunnerUK – Jul 5, 2022

Reskilling be like –

– Somebody posts some gibberish,

– Everyone in the community knows what they’re talking about.

– You look at the goldfish going “bob” and wonder if that’s your level.

Then you realise you don’t even have a goldfish.

@codeRunnerUK – Jul 6, 2022

Like an infinite number of monkeys on their typewriters, if you bash away at the keyboard for long enough you’ll find the solution to your error.

You may not know what you’ve done to find the solution, but you will find it …

My journey continues, thanks to @BigMtnStudio

@codeRunnerUK – Jul 8, 2022

People will never know how much uncommitted code you wrote. Hours of code written to solve a problem, then you figure out a better way of solving it, and all those hours of code never see the light of day.

Muddling through Core Data with @BigMtnStudio

@codeRunnerUK – Jul 11, 2022

Using PHP to get data from MariaDB, and turn it into JSON, so that SwiftUI can retrieve it, decode it, and store it in Core Data on my iPhone.

Guess I’m not so thick after all. But still got a long way to go.

@codeRunnerUK – Jul 11, 2022

Going so far down the rabbit hole that you get lost. Thank heavens for Source Control!

@codeRunnerUK – Jul 12, 2022

Today I had to write a bit of PHP/MySQL. Before I knew it, there’s 400 lines written like I was writing a novel. A normal day with SwiftUI/CoreData might net me a dozen lines if I’m lucky.

Will I ever be as proficient with SwiftUI as I seem to be with PHP?

@codeRunnerUK – Jul 13, 2022
%d bloggers like this: