Hi, Alex here from rebeloper.com and welcome back to the channel. Now in this
tutorial series I will show you how you can sign in passwordlessly
to firebase in the help of swift 5. So without further ado let's jump right into it.
Okay, let's just see what we have here and make sure that you have your phone ready
because we are going to send a magic link to our device and it looks like we
have some code of trouble here but I do have the test installed there so I would
just tap on there and as you can see we have a sign-in button and let's just
step on there and add in our email and then let's just click on send magic link.
Okay, now we can open up our mail app. There we go and as you can see we have an
instant no reply from testing password let's sign in and I will tap on and that
and you can see it says please click this link. So let's tap on there and it's
working and there we go. You have successfully signed in with
your email and that is okay and of course we can sign out if we want it to.
Okay. That is what we are going to build out in this tutorial series so let's just
jump right into it and first of all make sure that you download the resources
from the link below in the description and you will see something like this.
Colors assets, a helpers folder with all of our helpers files, a pod file and
review controller and a sign-in view controller. This is just the basic setup
so I don't waste time setting all of this project up. So let's just go ahead
and create a brand new project. Go to Xcode file
new and project. There we go and I will select my single view
application that is you can find that in my tutorials and basically it just
eliminates the main dot storyboard. So let's click on next and I will name this...
Okay, let's click on next and let's drag and drop it onto our desktop wherever
you would like it and I will choose my videos, there we go.
I will create a github repository for that so you can of course take a look at
it on our github repositories. There we go.
Okay, now what we want to do first is add in our pod files. So let's just close all
of this maybe minimize the test project and open up our pod file. Okay let's
just drag and drop all of this on to xcode and as you can see we have four
pods there. So let's navigate to our code that we
have just created and open up terminal here and type in CD and the space and
just drag and drop the root folder and hit return and type in pod init to
create the pod file and then you just drag and drop the pod file onto your
xcode icon and there we go here we have our new pod file. And all I will do is
simply copy all of the pods from the example from the resources that you have
downloaded and add it right over there. One more thing let's comment that out
and the platform should be iOS 12. So that is it let's close both of these and
run pod install in the terminal, okay. It is analyzing dependencies and it's
downloading and this may take a while for you depending on your internet
connection and once this is done a new Xcode workspace will be created and we
will use that Xcode workspace from now on because here we are using
cocoapods. So let's do that and open up our newly created Xcode workspace and
let's add in some more resources here. First of all let's just double check
that we do have that pot file and we do have those pots great let's close that
and what we want to do here is first of all let's delete this root view
controller because we are going to replace it and go ahead and take a look
at your resources and you will see a root view controller and a sign-in view
controller. So let's just simply drag and drop both on to your project make sure
copy items if needed is checked create groups is checked and of course your
target is checked. So let's click finish there and both of these Swift file
should appear real soon and now let me just maybe add in our assets so for
the colors. So there we go let's drag and drop that under the assets catalog.
So let's click on finish there and as you can see some files are also missing and
those are in the helpers folder. So what I'm going to do is create a new group here.
So let's create a new group and I will name this new group helpers.
There we go and I will add these helpers into that folder that we have just created, okay.
Pretty awesome stuff. Okay, let's just wait for those to be populated in and there
and maybe I will just simply drag that all the way down maybe under the assets
catalogs, okay. One thing that we are going to do today is to create an app in app
store connect because frankly we will need the
app id that we are going to get by creating an app store connect app and for that we
are going to have this bundle identifier that we have created being registered on
the App Store Connect. So let's just simply enable in-app purchases so Xcode
makes its thing and creates our app ID or bundle identifier in the Apple
Developer Portal and I believe we can safely disable that. So we are going to
just wait a few minutes now because it's not automatic and insolent/
Okay, till there let's just hit command B and
see if our project builds up correctly and hopefully it does. Let's just wait
for that and till them let me just talk about these helper files. Well we have
our hud file, basically we are displaying information about the status of the app
with the hud like okay we're signing up we are selling our data and so on.
Under service you will see that we have an auth state and basically the auth state is an
auth state. This auth state is a part of firebases firebase auth so that is why
we needed to import that in here and we have two types of auth states: signed in
and sign out. Of course we are setting the default value to sign out because
yeah the app needs to check when it launches if we are signed in or sign out.
Now pretty straightforward. Now let's go to setup you are not going to use or
modify anything in these helper files except maybe for the key of the firebase
open app dynamic link, we will talk about that later on
otherwise these are just keys you are not going to modify. Here we have our UI alert
service that is a UI alert controller helper.
That has some real helpful show alert functions and finally we have a UI
application extension that grabs our topmost view controller that is needed
for our UI alert service. And if you noticed the project built out
successfully. So that is really really nice and now it's time to create our app
in App Store Connect. So open up your favorite browser and go to App Store
Connect and let's create our app there. Let's just log in here and I will use my
secret password there and let's go and select our team and you will see that we
will shortly have a plus sign at the top left corner of our screen. But of course
we need to enter my apps to do that. So let's just wait for it and let's just
create a new app, okay. And let's see if we do have our bundle identifier if you
recall and that is called com.rebeloper.FirebasePasswordlessSignIn
So let's see if that is already available. So under choose bundle ID let me just make
this so you can see all of the screen. So let's choose. So firebase maybe or let's
see Xcode, this is that, okay. So firebase
passwordless sign in and I will make the platform iOS and it will be fire
base passwordless sign in, okay. So let's choose our primary language now and it
will be an English us and let's just paste this name for the SKU and I need
to delete the spaces here for the SKU full-access
is okay. So let's create it now and after a few seconds you
app will be created and let's just wait for that there we go. Here we have our
bundle ID and here we have our Apple ID and we will use that in just a moment.
So what we need to do that next is to go to the firebase console and let's create an
app for this tutorial. So click on add project and again it will be firebase
passwordless sign in. I accept the terms. Let's click on create there and it
is creating our project and with that we are going to finish for this video but
in the next one we are finally going to set up everything that you need to do in
the firebase console because there is a lot to do. So once your project is
ready click on continue and you will be taken to the get started page of
firebase console. So that is it for this video and I hope you enjoyed this one.
If you did go ahead and give it a thumbs up subscribe to the channel and hit that
notification bell to get notified of the second video when it comes out because
we are going to of course set up everything in the firebase console and yeay firebase.
Okay, I will see you in the next one.