silviaespanagil / CloudcardsFirebaseIOS

Exercise to learn how to use Firebase in an iOS app.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS: Studycards

A firebase database and Auth exercise

Β‘Hola mundo!

Until now and after doing a couple of apps, I haven't tried to do a login area. So, I decided to do a little Firebase course to learn to:

  • Create Firebase databases
  • Create the Auth

The app is a simple CRUD with a custom database, where the user can write down a question that wants to studyπŸ€“. After answering the question, the user can click on the card that is going to flip, and there the answer will be displayed. Now the user can self evaluate: -> πŸ‘ Did it now the answer? Thumbs up! -> πŸ‘Ž Didn't knew it? Thumbs down, and keep studying. When you come back you will see a message under the failed questions so you can try again.

Some Requirements πŸ“‹

  • Create a Firebase Database
  • Get, add, remove and update data from the database
  • Manage possible login messages such as wrong password, existing or unexisting user
  • The user can login and logout
  • The user can check the password while trying to login
  • The user can add as many cards as wanted
  • The user can delete the cards
  • The user can self evaluate itself. If the user didn't knew the answer and click on thumbs down a message will be displayed in the card

Built with πŸ”¨

  • XCode
  • Swift
  • SwiftUI
  • Firebase

Development ⌨️

Cloud Firestore setup ☁️

I started adding Firebase into my app and after it the first step was to set up Cloud Firestore. Cloud Firestore allows you to create simple databases to store data, here you can add as much endpoints as you need and to create documents with different fields that should be typed. To check everything was allright and working properly I created the first document directly on the Firebase console.

Managing of the database πŸ‘©πŸ½β€πŸ’»

As I said, I created the first database document directly on the Firebase console so first thing to do was to create a getMethod to call the database and try to render its content. This was like the confirmation that both the database and the Firebase integration into the app were right. With this working as expected, I added also an add, adelete and update methods, just to be able to do those actions directly from the app.

User authentication πŸ”’πŸͺͺ

This is the first time I work with Authentication in one of my own apps. To do so I configured Firebase Authentication with an Email/Password login. With this the app changes a lot as you can't use it after actually logging in, the pro of this is that now the card creation is related to the user. So anyone that logs in can create, manage and delete its own cards. After the user finish using the app it can also logout. Screenshot 2022-05-05 at 11 25 22

Error feedback ❌

Until now if there's something wrong the user does not receive any alert, so, if an email is duplicated user can't create a new account but it doesn't know why. So, I added alerts so the user receive error feedback.

Screenshot 2022-05-05 at 12 36 42 Screenshot 2022-05-05 at 12 36 18

Check out the app in motion πŸ‘€πŸŽ¬

Simulator.Screen.Recording.-.iPhone.12.Pro.Max.-.2022-04-29.at.16.27.13.3.mov

Want to fork this repo? πŸ‘

Feel free to fork my repo, but, if you want to learn a lot I recommend you to follow this tutorial

About

Exercise to learn how to use Firebase in an iOS app.

License:MIT License


Languages

Language:Swift 100.0%