Hi Alex here from rebeloper.com and welcome back to our tutorial series
about saving, uploading, downloading, taking UI images on Swift 5. Now in the
previous episodes we have taken care of saving images into your device and onto
your photo library and a custom album. Go ahead and take a look at those if you
already haven't done so and today we are going to finally start working on
uploading our image to Firebase Storage and then of course we will be
downloading it to our app.
Now today I am going to talk about the whole Firebase
setup so there won't be a lot of code today but we are going to finally setup
Firebase so it can work with this app. As you already know we have added our Podfiles
and we have installed them. That's been taken care of so now we want to go
to Firebase. Go ahead and go to your Firebase console and we are going to
create a brand new app. Click on that plus button and let's name this and I
want to name this Swift Image Mania. And that is correct so there we go!
And I accept all of the terms. Let's create our project here and yeah that is what
we want to do and well this is kind of a time-consuming process but yeah it is
really fast it depends on your internet connection. Let's hit Continue there
and we are taken to our starter page here. And what we want to do first is
create an app and it will be of course an iOS app. Let's click on there and
the first of all we need our bundle ID.
Let's grab that. There we go. Let's go to general and copy and paste that into our
browser. There we go. Let's click on register app and we should be able to
download our config file, so click on Download GoogleService Info.plist file.
And that will download it to your downloads. Let's go back to Xcode and
just simply grab that and drag and drop it onto your project. Make sure copy
items if needed is checked, create groups is checked and swift image mania the
target is checked. Click on finish there and now you can see that we have
this fifth and GoogleService info, if you are downloading a lot of info plist
files yeah that will be how it goes but just simply need to delete it like so.
Make sure GoogleService info.plist is the name. Okay, let's go back to our browser
click on next and let's add our Firebase SDK. Well we already have done that so
let's click on next and now we need to import Firebase and and this is kind of
redundant I believe so let's go ahead and type that in
in our AppDelegate. Let's select our Xcode, select AppDelegate and let's
import and FirebaseCore. Yeah, so not just Firebase, FirebaseCore. Well Firebase will
most probably update their documentation. If you are watching this in the future.
Next up let's go to our application didFinishLaunchingWithOptions
function and there just type in FirebaseApp.configure( ) and that is it. Okay!
Let's do the next steps! Let's click on next and skip this verification of
installation because we are pretty sure that all of this work. Now what we need
to enable is the database and the storage. And yeah we are not going to use
Authentication because that is a whole another topic and it's quite
time-consuming. What I will do to make access to our
database and storage and I will open it up. So anybody can read and write
but that is a really really bad idea, if you are doing this in production. Yeah,
this is just for testing purposes and the purpose of this tutorial.
Let's take care of the storage first. Click on get started here and as you can see
the security rules allow read and write if the requester has an authorization.
Let's click on Got it because yeah we can't do anything else but we can change
the rules here. And I will just simply delete all of that if statement.
Let's publish it. Yeah it will say that Okay now this is a bad rule don't
really want this but hey well this is just for testing purposes. Now let's go
to the our database and then let's use Cloud Firestore. Because yeah the newest
and shiniest database from Firebase is Cloud Firestore and we are going to use
that. Let's click on Create the database and let's start in test mode as
you can see allow read and write to all. Okay let's enable that. And once that is
done let's check on these rules and yeah it most probably it is okay. Now we can
change this if we wanted to but I don't want to mess with authentication for
these tutorials so we won't do that. Okay, now that we have done that I believe we
are ready with the setup. Okay, let's go back to Xcode and to our RootViewController
and let me just wide you through what we are going to do in the
next episodes. We are going to upload our photo and then and download it. Okay!
I hope you enjoyed this video it was a short one but a sweet one on how to set
up your app to be able to use the Firebase API's.
And as usual go ahead and give it a thumbs up, subscribe to the channel and
hit that notification bell and I will see you shortly in the next one!