DEV Community

Midhet Sulemani
Midhet Sulemani

Posted on • Edited on

Cloud Firestore DB with Swift

As most mobile application developers I have encountered in my experience, have a basic understanding and experience in connecting and implementing a basic database structure and design for an application prototype or a side project they might be working on. But as for me, who switched from front end web development to developing apps in Swift, I didn't have a clue on connecting databases to build a working application with web services.

David saying he has no clue

After a lot of begging my backend dev friends to make databases for me and getting a lot of annoyed rebuttals, I decided to take matters into my own hands. I discovered how to use Cloud Firestore for designing my own database and web services. An overview on getting started here


Since Cloud Firestore is based on a NoSQL database, you can use the service as a data dump, but also add some structure if you'd like. A little bit of understanding of terminology between SQL and NoSQL databases and how you could turn a NoSQL database into a relational one.

An explanation on how this will work out:

Translation of terminology between Cloud Firestore and a SQL based Relational DB

Let's take an example of a database of Cars and their owners in a City/Administrative region.

Cars have information on their owner, model and license plate number. Owners have their id, name and email/contact.

The following image will show this design in a Relational Database:

Cars and Owners DB design in SQL

The next image is a translation of the same design in a Cloud Firestore DB:

Cars and Owners DB design in Cloud Firestore


To learn more and get a sense of the working of Firestore and its queries, you could try out this codelab


Apologies for my handwriting in the DB Images. Hope you understood what I was trying to say. That's all for this blog!

Bye bye GIF

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay