Firebase Authentication Tutorial 2020 - Custom iOS Login Page (Swift)
Вставка
- Опубліковано 7 чер 2024
- In this Firebase authentication tutorial, you'll learn how to create a custom login page for your iOS app. We'll be using Swift and building our own custom user interface for this iOS login page.
Furthermore, you'll also learn how to do some form validation with regular expressions and you'll also learn how to add extra custom fields to your sign up form and capture that data in the Firestore database.
I'll be showing you both the Register workflow for a new user and the Login workflow for an existing user.
The type of Firebase authentication I'll be demonstrating is with email and password. In future videos, I'll also show you how to perform social login (ie. logging in with Twitter, Facebook, Google, Apple, etc) so make sure you hit the SUBSCRIBE button!
Source Code and Xcode Project
⚡ codewithchris.com/source-code...
Firebase Authentication Documentation:
⚡firebase.google.com/docs/auth...
Regular Expressions in Swift Blog Post I Used:
⚡iosdevcenters.blogspot.com/20...
Cocoapods Tutorial:
⚡ • CocoaPods Tutorial - H...
🚨 SPECIAL CWC+ OFFER FOR UA-cam:
cwc.to/youtubeoffer
MY FREE ONLINE COURSE:
⚡ How to make an app in 14 days - cwc.to/14days
CWC+ PROGRAM:
👩💻 All our courses in a learning path - cwc.to/plus
WEEKLY UPDATES VIA EMAIL:
✉️ Every Saturday, receive an email digest of new content - cwc.to/newsletter
CONNECT:
🌍 Website - codewithchris.com
😺 GitHub - github.com/codewithchris
📸 Instagram - / codewithchris
🐦 Twitter - / codewithchris
ABOUT CODEWITHCHRIS:
Hi I’m Chris! I’m dedicated to teaching fundamentals about how to make an app. This is important if you’re trying to land an iOS job, be a freelancer, increase or start a business with an app idea. On this channel and my website, you'll find a ton of free resources and tutorials to aid you on your journey to learn iOS development. Many people have learned to code and build apps on their own! cwc.to/reviews
About this video:
I've done tutorials using Firebase Authentication before but many people requested that I do one with a custom-built UI instead of using the pre-built UI that Firebase Auth provides. That's what this tutorial covers and because I'm also showing you how to do form validation, the tutorial is pretty long! There's also a bit of Firestore database integration in this auth tutorial! I hope you're able to use this for your own iOS app login page. If you do, please comment below and let me know! :)
#CodeWithChris #FirebaseAuthentication #LoginPage
QOTD ⚡ What else do you want to see about Firebase Authentication? Let me know! 👇 Kick start your own app with my free 7 Day App Action Plan ➡️ bit.ly/7dplan
Other Authentication, like google sign-ins
Using the database to store images and documents etc, then retrieving them to the app. Thanks Chris, your No 1 on YT buddy...⭐️⭐️⭐️⭐️⭐️
Please upload phone number authentication tutorial and database tutorial like how to save data from app to the database automatically and how to retrieve them and show in the app or update if anyone tapped on forgot password then how to handle this process? It will be helpful if you make an app where we have to do all these things. You can make blood donating app or something like this. Where everyone who wants to donate and who need blood has to create an account. Then we need to store their info in our database like blood groups, addresses, phones, emails. Thanks!
It would be awesome if you could show a video on how to store the authenticated user's data (such as from a text field) into each user's account! Maybe you could store that text field into a TableView and that information would be saved per user account! It would be great to be able to connect all of your videos into one. It seems like a majority of us are wondering the same thing based on other replies. Thanks Chris!
Hey Chris, I really need this same tutorial using SwiftUI.
Now SwiftUI is kinda stable and I decides to skip learning UIKit and start iOS development with SwiftUI. So please, I really need a SwiftUI Firebase Authentication video.
Thanks for your super useful tutorials.
Chris seems like such a nice guy. Like he never tries to sound smart or talk down to you or anything. It's nice to learn from you man. Thanks for doing what you do.
Thanks for the kind words! We agree with that. :)
- Kat
Yeah, I took his pay course. It's definitely worth the investment if you want to program iOS/Swift
IKR! God bless Chris for making this channel
He even goes through the errors he encounters, where most of the people doing tutorials just edits those parts. Even though he knows how to work around those errors, it's always a good experience and a guide for beginners.
UA-cam is still processing the higher qualities so 4K quality will be ready in a few hours!
best birthday gift to me 😍 thanks Chris!!
Happy Birthday to you! Have a great one!
Youre a legend man i swear to god, absolute legend. keep the vids up!!
Thank you so much!
-Kat
Honestly, I've been trying to learn to code since 2010, with no progress and no positive results at all. Until I discovered your channel, you make it look so easy and understandable to learn new stuff and I feel very motivated each time you upload new content. Keep up the good work!
So glad to know you have learned a lot through the tutorials! Motivates us more to keep making content! Good luck and enjoy coding!
-Kat
Never touched FireBase at all Chris. Watched your fantastic video, took loads of notes watching it, twice, opened Xcode 11 and coded up a login, registration and welcome screen in an hour. Couple of silly formatting errors I had, but all fixed and running sweet. Now i'm gonna try and get it running in SwiftUI. That would be a damn game changer. Thanks Chris, you are the best on UA-cam IMO mate. Very thorough and straight to the point. Can't wait for the next one buddy. Keep checking my phone in case i've missed the notification from YT. ⭐️⭐️⭐️⭐️⭐️
Thank you very much Steve! Your kind words motivate us to keep making more content!
-Kat
It's cool that you leave a portion (not the entire) problem(s) you encounter and the reason for the issue - it helps me associate the function / significance of initially abstract concepts. For example, when you forgot to import the pods at around the 1:00:00 mark which lead to the member functions not working. That helped me understand the process, significance and function of importing the pods into my project.
Thanks, as always for the quality content & teaching!
Thanks for the feedback! Really appreciate it.
- Kat
This is by far the best tutorial I have seen since I started developing in Swift (2 days), you really cover everything in one single video, thank you very much Chris for creating such an incredible tutorial, I learn how to navigate, add associations, render new controllers, associate controllers with the view, that is amazing!
Wow, that's great to hear!
- Kat
you started learning swift from wrong videos / this is a tutorial he didnt explain the basics / many things are to hard to understand for begginers / my suggestion , watch stanford developing on ios 11/ best course i've seen
You are a lifesaver. Thanks man for your pedagogy. You explain well the concepts. You Deserve one billion likes.
Thank you so much for the kind words! Knowing that the tutorials have helped is enough to motivate us!
-Kat
I LOVE your videos! They help me out so much! Everything worked :) definitely subscribed now
I have a game plan...watch a video about something, do it and learn something different. BUT your videos are just sooo good about IOS I have been literally spending 4-5 hrs a day watching them. Thank you! Hopefully, the knowledge will come in handy.
Thank you so much! Make sure you practice too and not just watch. 😄
Kat
Just came to tell you, you're a legend and I wouldn't have made it through uni without your videos.
Thanks for mentioning that! We're happy to know we've been a big help. 🙌🙌🙌
Kat
Chris I've been a senior software engineer for 10+ years now and recently been tasked with learning Xcode. Hooked into your 28 day program after just a few days was able to implement some concepts we were intrested in... thanks for your help
Thanks for choosing to learn with us! Hope you try the other series as well!
-Kat
That is so awesome!! Thanks for making my day :)
Thank you for the detailed walkthrough Chris! This was the best source I've found for Firebase authentication. Much appreciated!
Thanks for your kind words! It means a lot!
-Kat
Thank you with all my heart. I watched many videos for my project. I was used realtime database and i have i problem with read users info from database. Now i watched your video and decide to change may project because you r really good teacher. I got it everything in this video. Thank you so much
Thanks so much chris for a practical detailed and hands on view. Very refreshing to see a more realistic insight into developing a project along with making mistakes as the process. This is very important as software development often follows a similar series of steps. I really cannot believe that with the number of views of the tutorial only around 650 have bothered to like this video. Keep up the great work and continue making your excellent tutorials.
Thank you so much for your feedback. That's enough motivation for us to keep making more content like this. :)
-Kat
This was awesome! I used your tutorial to do some integrations into my own app. Very easy to understand. Granted, not everything was perfect since I had already my own project and ended up with debugging and errors, but as a beginner like myself, this tutorial was awesome. Thank you Chris! :) p.s It works :P
Glad it helped! We'd really appreciate if you wrote a testimonial for us. Thank you for your kind words.
feedback.codewithchris.com/
- Kat
Looks like you used this tutorial for the same thing as I did!
🤓
Bro chris is the legend. RESPECT.
Thank you! 🙌
- Kat
You are honestly one of the best people for computer science I have seen on UA-cam, thank you so much for your videos
You're very welcome!
- Kat
Thank You Chris! Every time you make a video remember the fans you inspired to become coders! You really make a great difference! :) Keep it up with the great videos man!
Thank you so much for the support!
- Kat
@@CodeWithChris btw I was watching a 2016 Firebase tutorial for my app and I was confused, so I came here and this updated info rocks! Thanks :)
I really enjoyed going through this tutorial. I learned a ton.
Great to hear! 🙌
- Kat
Hey Chris! I love your videos! I have a question regarding keeping users logged into the app once they have logged in or signed up previously. Do you have any further videos where you deal with this or can you refer me to another source which can help me with this?
Hello, there is no "stay loggedin" state actually, what you could do is probably save username and password using UserDefaults and have it "auto login" when you launch your app
- Francis
I just got in to Xcode, having learned java and stuff without any real use for it. You really helped me to get to know xcode and how it differs from what I know. thanks for being so patoent and explaining every little detail. Subbed
Thank you! 🙌
-Kat
Just went through the whole video coding along and wow! I learned SO much! Thank you for the video and I can't wait for more!
Thank you so much, M! More power to you! :-) -Arthur
Absolutely elementary explanation tutorial. Extremely helpful mate.
Question as an absolute starter: When’s User Logs in, how do we get to show the user login details on the welcome page such as WELCOME CHRIS, LAST LOGGED IN ON: 23.3.2018 for example and perhaps also extract a value from the database that may have been stored during the count creation ?
Your help would be immensely appreciated.
Thanks.
Ram
Hello, you can easily do this by adding an extra attribute during account creation or create a table just for logging when a user logs-in. You can always call two separate inserts or more during the same function call, you can also improve the welcome page by using the value that you query from a table to display it in the welcome page
- Francis
Hi Chris! Thanks for awesome tutorial! But I wonder if this will keep the user logged in or if the user has to log in everytime to use the app? How can I add a feature that allows users to stay logged in even though the app is closed?
Hello, maybe you can set a local variable to save the state/info of the user, some sort of "remember me" functionality that should auto log-in the user or use saved info to authenticate the user without having to log-in again
- Francis
I always love your videos so much, the way you explain so well and clear I can't stop bingewatching your whole channel
Yay! Thank you! ♥
- Kat
Very good course, I was able to follow up with you and built the app. Also adding Sign out option and navigation to go back and forth. Thanks a lot man!
Great job!!👏👏
-Kat
Hi chris, I got a question after I followed your turoial. I knew the data of user like name is stored in database, how can I fetch that name of logged in user? and what the right way to add document under that logged in user? It's a very great tutorial BTW. Thank you
Hello, we created a forum to help people with the tutorials. Could you share your questions to our CodeCrew Community codecrew.codewithchris.com/? Thanks!
Kat
It would be great if you can make a video on reading and writing data using firebase in real time.
Thanks for the suggestion!
-Kat
@@CodeWithChris Any update on this suggestion?
This is one of the cleanest tutorials on Swift man. Your dictation and pace is on point. Subscribed and liked immediately. Keep it up mate!
Thank you so much! We can never thank you enough for your support. Keep on having fun! :-) -Arthur
Finally got thru the vid after endless procrastination ur the 🐐 bday twin LOL ! Thanks for these vids I’m super excited !!! Keep up the great work Chris n team !!!
Thanks for the support! :)
-Kat
Hey, Chris!
I can't sign up a new account, after writing the code for testing if a password is secure enough, no matter what password I'm typing in. Do you have any suggestions of what the reason may be?
hello, there might be something wrong with your logic on how to test the password, you might want to look for help on that one instead. If your app is fine when you remove the security for any password then it is surely the logic in your code that's causing the problem
- Francis
Hi Chris, I’m stuck on min 24 of the video when you add a class folder that contains the design of the registration. I’m confused. How can I access that folder.
Hello, those files were manually created and linked to a storyboard page at around the 3 minute mark
- Francis
chris you're a legend there's no one out there with swift guides like you lol my guy's got a monopoly on quality ios development content
You're too kind, thanks Noah! -Arthur
Thanks for another great tutorial. I think it would be a good idea to post the video background tutorial as a separate video as well; that was a total bonus. I had searched for ways to implement a video background and eventually got it to work but your method is way more clear. You rock, Chris.
Thanks for your feedback, Kevin! :-) We'll remain motivated to produce better content because of very kind students like you. :-) -Arthur
Chris, how do I get The pod init to work it says -bash: pod: command not found. Thanks
Hello, you will need to install cocoapods for that, i also suggest to be familiar with cocoapods as well, check out our article on it codewithchris.com/cocoapods/
- Francis
Hey Chris, I've got a question. I wrote exactly the same code and implemented everything with my firebase account, but in the signUpViewController it says always Use of unresolved identifier 'Utilities' and Use of unresolved identifier 'Constants´
I have "Use of unresolved identifier 'Constants" as well
Hello, did you add the Utilities file to the "target" you might also need an updated version of firebase for this so just check the documentation on how to install
- Francis
@@CodeWithChris I have the same issue and I just installed firebase yesterday so not sure if that could still be an issue. In regards to the Utilities file, I haven't touched it really outside of the password verification and it is in a folder with the Constant file
CodeWithChris okay I’ll check. Thank you very much for helping me I don’t know if I could do this on my own 😍
Your videos course my recipe for my brain 🧠.. thanks Chris for continuing boosting my coding skills.
Thanks a lot! Enjoy coding!
-Kat
I'm so appreciative for this. I started selling App using a generic temple and building on it. This make it so easy and now because of your videos I'm able to do more and offer more to clients. I'm definitely donating to you as soon as my client pays for this app. You're the best. Thank you.
Thank you! But there's no need to donate. If you want to support us, we appreciate if you'll purchase our course instead. :)
- Kat
Could you do this in SwiftUI and also Integrate Sign in with Apple ID?
Hello, I'm pretty sure its possible but you have do to everything manually as there is no storyboard to help you drag and drop to design your page :)
- Francis
@@CodeWithChris Thank you ;)
Hey Chris, around 40:38 when I try to run the app it crashes. The debug navigator pops up and says it cannot find a valid GoogleService plist in the project even though it is in the right place, the same exact spot as yours. It gives me this link: github.com/firebase/firebase-ios-sdk/blob/master/README.md. I have no idea what to do, my code I entered is the exact same as yours, our projects are identical. Please help!
Hello, make sure your GoogleServices-Info.plist is written exactly as that, not GoogleServices-Info (2).plist because it will not read that
- Francis
CodeWithChris thank you! This fixed the problem.
Once again you have created another incredible tutorial that explains everything very clearly. Thank you for your hard work, you deserve all the success that will follow!
You're awesome man, really appreciate what you do! Great teacher, clear and thorough :)
Thank you! 🙌
-Kat
when i click sign up it says this > Thread 1: Exception: "-[testapp.SignUpViewController singUpTapped:]: unrecognized selector sent to instance 0x7f9e4e46d220". how do i fix thix?????
Hello, it seems that you are missing a function called "singUpTapped", maybe you forgot to make it or changed it to another name?
- Francis
I have the same thing, did you find a solution?
I had the same problem. I would recommend you to reinspect all the outlets and actions. There might be a conflict in those. I removed all the connections and reconnected them and it resolved the issue.
38:09 TO ALL ""M1 Processor"" MAC USERS:
When doing -- pod install -- you will likely get an error.
Do this:
sudo arch -x86_64 gem install ffi
Then
arch -x86_64 pod install
THAT WILL ALLOW FOR M1 PROCESSORS TO BE COMPATABLE.
Awesome, thanks for sharing this tip! :-) -Arthur
Thank you Aaron - you’re a life saver!
You are the best!!! Thank you for the most comprehensive, nicely distributed tutorials ever!
Wow, thank you!
- Kat
Chris, you are truly an amazing teacher. Thank you very much!
Thanks for your kind words!
-Kat
When launching the project and trying to sign up all works perfectly, except for the database. When I go to the auth menu the new user appears perfectly however it doesn't appear at database "users"
Adrian Castello sane here man
Hello, is your database in "test mode" meaning it allows read and write from everyone?, i suggest doing this first to see if its a permission problem
- Francis
CodeWithChris okey thanks!
@@CodeWithChris this helped. thank you!
I just wish the user can automatically be logged in
Hello, you might be automatically log-in the user if you save his username and password in UserDefaults, you might need to code it yourself a bit but it should do the trick :)
- Francis
Thanks for the different ides but I used stack overflow to find the answer
You’re trick requires the user to click the login Button
@@Wonixer Can you tell me how? or at least give me the StackOverflow link to do it please. Thanks
This is a beautiful tutorial, thank you for posting this video. Two things though. If you want to bring up the assistant editor on the right file, hold the option key and select the file. Also, I saw in one of your view controllers that you had imported Foundation and UIKit. Foundation is actually included in UIKit so you can replace import Foundation with import UIKit where necessary. I don't know much about programming but those are two things I have learned :) Happy Programming!
Thanks for the tips!
- Kat
Thank you Chris!! I appreciates your time to make these videos and I am on my way to make an app for my existing business.
Awesome! Share it with us when it's finished!
- Kat
hello brother , its so nice of you . that was great tutorial .. you are loved by me because you never tries to sound smart or talk down to you or anything. It's nice to learn from you man. Thanks for doing this all .
Salaam, Muhammad! You're very much welcome! You are a wonderful part of the CodeCrew community. Shukran for learning with us! -Arthur
Just a quick note. I had an issue after adding in the firebase auth and analytics to pod file.
what turns out, i had to upgrade my version of os to at least mojave as well as upgrade my xcode version.
this then took me to upgrading my xcode developer tools and after that, I was able to compile / build / run my project.
This tutorial was great! and has allowed me to quick learn IOS app development / firebase use and build an app to boot.
Thanks to @CodeWithChris for this tutorial and your others, as well as your feedback when needed.
Glad to hear this! You're doing a great job!
- Kat
Thank you so much! You video jump started my App 3 weeks before it is due at my Uni!
Yay, cheers, Tyler! Update us on your app or project. All the best! :-) -Arthur
Another monster of a tutorial from the AppMaster! Thanks Chris
Welcome! Thanks for learning with us.
- Kat
My first time rocking you. Heard Many good things. Been a while since I firebased so need to brush up. Looking forward!
Thank you! 🙌🙌
-Kat
A fantastic tutorial. Thank you for making this. I had a few small bumps along the way but could find everything else using Firebase's documentation! :)
Awesome, thanks for learning with us! 🙌
- Kat
Thank you so much!! This was the only video that helped me build my interface. Thank you so much Chris, love the videos!
Glad you were able to get it up and working!
@AdrienVillez
Man I love you, with your Videos, I just Cracked my interView, You're a legend.
Keep Up the good Work
Thank you! 🙌
- Kat
Minute 18:00 - 20:00 i was struggling so much, took me hours to solve that i couldn’t reference things and i was so happy you struggled a few minutes later, made me feel less like a total noob
Cheers, we're all in this together, Lens! :) -Arthur
this channel is great I've been looking for a website to help me learn swift and this channel was better than anything I found!!
Wow, your comment just made our day, thank you, so, so much, Amal! :-) -Arthur
Thank you Chris. your videos are awesome!
Thanks a lot! Glad you enjoyed them!
-Kat
You are the best! Best tutorial! Nice warm voice. Nicely explained.
Thank you so much for kind words! We appreciate it so much! :-) -Arthur
Super helpful video Video, Chris!
Thank you! Glad you found it helpful! 👍
-Kat
You're amazing!!! Best IOS Dev channel as well as the video :)
Best comment of the day! Thank you so much, Ajay! -Arthur
I love you, Chris! Thank you so much for your tutorial!
You're very welcome!
- Kat
thanks a lot Chris, you are a awesome teacher
Glad you think so! Thanks for watching.
- Kat
Excellent! Thank you Chris!
Thank you for watching! - Pat
Brilliant video Chris. Thanks a lot. I learned so much and was a productive way to spend this time in lockdown! Thank you.
Glad you enjoyed it!
- Kat
Chris! You are a true legend Mr! Thank you for the tutorial, I have learned a lot. Everything works just like on the video.
You are so welcome, Adrian! Your kind words mean a lot! -Arthur
Thank you so much! the best explanation! you literally saved my life
👿 { Noooooo, come back to me!!!!!!!!!!!!)
@AdrienVillez
I think the best video explaining Firestore Auth, you are the best man, thanks
Thank you!! Have you tried it so far?
Kat
CodeWithChris yes, and works perfect, now I want to send an email to verify it, but I don t know how, I m trying to do it reading the documentation
Hey man Im creating a project and your a huge help. Keep doing what u do we all really appreciate it
We're cheering for you! You got this! -Arthur
You have greate tallent! You can make difficult things look obvious. Waiting for new videos with firebase, they seem to be very helpful.
Thank you so much! Make sure you're subscribed!
-Kat
CHRIS, THANK YOU, BEST TEACHER OUT THERE
So humbled by your kind words, Caleb! Have a great 2021! :-) -Arthur
thank you Chris! this tutorial was so helpful!! :)
You are so welcome, Marina! :) -Arthur
this is one of the best tutorials . Thanks a lot !
This was so helpful. Complete lifesaver. Thank you, Thank you, Thank you!
Welcome! Glad you found this super helpful!
Kat
thanks chris this video made my day 👌
Glad to hear it! Thank you for learning with us. 🙌
- Kat
Thanks for the video! extremely helpful!
Glad it was helpful!
- Kat
thank you sooooo much ! I tried many times with many errors specially tracking the curly brakets !! but finally it works ! and its working on my iPhone which I guess it can use my device network by default ! amazing
You're welcome! That's awesome to hear.
- Kat
Amazing tutorial. Thanks a lot man!
You're welcome!
- Kat
Thank you SO MUCH!! I have to develop an app for university and as I am a beginner with no experience you literally saved me😅
Glad we helped you! Keep on going! -Arthur
Thank you so much for this video! Very well explained, especially for beginners like me!
Glad it was helpful! Thanks!
- Kat
Chris you are doing great work brother keep on making videos for us . Love from India.
Thank you for watching our content! We have a new video dropping tomorrow!
Love from Toronto (Chris) and San Francisco (Me)
@AdrienVillez
That was great. I did my first app in 8 hours. Everything was pretty smoth.
Wow, brilliant! Proud of you! -Arthur
Thank you Chris for all your help!
You're so welcome, Melvin! Thanks for supporting us! -Arthur
Started with Basic Swift Swift programming tutorial and reached here😂😂
All because of this guy 😅
We appreciate you so much, Shubham! So humbled to know that we were able to positively impact your iOS app development learning experience. Keep on going! Cheering for you!
I don't usually comment on videos but this one was absolutely perfect! Thank you for helping me build my first app! Will be coming back in the future. Keep up the good work!!!!
Ahhhh, Ethan! Thank you so, so much! We'll be waiting for your return. Next time update us on your first app. Congratulations! -Arthur
@@CodeWithChris Still wonder how you add a back button though. Do you have a video on that?
Thank you for your hard work! I learned a lot!
That's great to hear! Thank you!
-Kat
EXCELLENT! Thank you for educating us, this tutorial is PERFECT!
You're the best! Thanks for making our day! -Arthur
Hi Chris , I followed your tutorials to build my own project with my own styling . Everything just worked fine also i added autologin and logout option . If user is logged first time by saving token
Congrats!!!!!
@AdrienVillez
Hi! That's honestly so cool. I was wondering how you did it. Thanks!
Million thanks for the tutorial, you are the best Chris, greetings form Perú
Thanks for the kind words! Really appreciate it!
-Kat
Awesome, thanks Chris.
Thank you for watching!
-Kat
This was really helpful! I was wondering for another video if you could show how to make a comment section using Firebase. Anyway, great work as always :)
Great suggestion! Thanks for watching this tutorial!
- Kat
really brilliant video! easy to understand and great intro into ios development for me! cheers!
We appreciate you a ton, Haza! :-) -Arthur
Truly comprehensive.....Thank you so much.
Thank you as well! Keep on having fun! :-) -Arthur
Love your Videos! Helped me so much to get started!
Glad to hear that! Thanks for watching!
Kat
Bravo, your percision is only beat by your kindness.
Thank you so, so much! We are so humbled! :-) -Arthur