Β‘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.
- 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
- XCode
- Swift
- SwiftUI
- Firebase
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.
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.
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.
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.
Simulator.Screen.Recording.-.iPhone.12.Pro.Max.-.2022-04-29.at.16.27.13.3.mov
Feel free to fork my repo, but, if you want to learn a lot I recommend you to follow this tutorial