Hi Alex here from rebeloper.com and welcome to Day 6 of ASD the App Store Domination.
Where you will learn how to dominate the App Store with your
app business. So let's get started!
Okay! Let's get to work and in today's episode we are going to
talk about storyboards and why I really don't like them and why I really like to
code everything inside a Swift fire. Let's take a look at our current project
and how it all looks. Well as you can see here we have our storyboard and you will
most probably see a storyboard inside your Xcode project. If you have bought it
from anywhere else if even from our side there are older codes where I just
simply had it or when it left the main. storyboard inside my project.
Now let me just show you how this looks in our latest app here. And let me just go to
update course and Anti Candy Crunch 11 and I will just simply open this
workspace up and show you how this looks. And if you just try to look around well
you will see that there are no... well there isn't any main. storyboard.
And let me just scroll here down and you will see that Main interface it is empty.
And that is because I have removed it. Really like to code everything out
inside a Swift file. And there are a ton of reasons maybe loading time and
when your project gets a little bit more complicated then you have a
massive storyboard and you can't really figure out. And if you want to change
something then you need to go back in there and you need to find it. It is very
very time consuming and there are maybe a lot more reasons why you should
not use storyboards. Well first of all you understand code more easily. You just
need to learn it once and then you have to apply it and then you just know what
that code means. Now what we need to do now I would just...
...well if you want to take a deeper looping into Anti Candy Crunch
and maybe you want to make your own version of Anti Candy Crunch and put
it up on the App Store then you can do so. It is available in The Tribe and make
sure that you check out. You can take a look at The Tribe and I make sure that
you have a link down below with a discounted price. Okay! Now next up is
that we want to get rid of our main. storyboard. I will show you this
today. First of all let's just simply delete it. Okay, let's move it to trash we
are done with it. Let's move it! Okay! Next up is that you
go to your project and select your Targets and in General just simply
delete this Main. Okay! And click anywhere else and it has been deleted. Now if you
run your project now no storyboard is available so it could not
reference it. So what we need to do is go to our AppDelegate and grab our
ViewController and add it here. Now for that what you need to type in here and
let me just make this font size a little bigger. Okay! What you need to do here is
type in: window = UIWindow( ) and we will initialize it with this empty
constructor and now the next step is to make this key and visible. So: window.makeKeyAndVisible.
Now that is all what you need to do with the window. Now we
need to add a new ViewController to the rootViewController of our window.
It's kind of sound scary but it actually isn't. First of all let's create our
view controller. So: "viewController =" and we will initialize it with our
already created a ViewController. That is it! Now last step is that you need to
grab your window.rootViewController and add it like so:
window?.rootViewController = viewController
And that's it! Okay!
I believe in the previous lesson we have made the background red so let's test
this out. Let's Build and Run on our iPhoneX simulator. Let's see how that
looks. Okay, here we have it our background is red. Good stuff! That is all
that we are going to cover today. Hope you enjoy this and as usual I will see
you in the next App Store Domination episode tomorrow. So get to work good!
Good stuff! Now if you want to see more of this video and want to boost your
app business go ahead and take a look at my 30 Days Challenge App Store Domination.
Go ahead and click the link down below and I will see you inside
ASD - App Store Domination! Let's get to work!