and it’s comp 3025 it’s week three less than three part two we just finished talking about a little bit of design pass a little tableau around the people who were here to keep you guys busy right but one of the things you have to consider also is the size when you create a UI we talked about you I la you know the beginning of this thing the other thing is how big sure your buttons beat when you create stuff and the great thing about Xcode and now let’s bring up the export interface I’d like you to do the same thing to you have an Xcode interface in front of you even though we can’t program we can’t do a program with you know with Swift today let’s look at the Xcode interface a little bit more closely because you can still use the export interface in front of you to do basic some basic design so let’s do that ok so I’m going to go to my developer tools and I’m going to pull up my xcode and again on Xcode 6 you have the ability to do playgrounds and and stuff which is what i’m looking forward to with you guys as we move forward later on in the course we’re going to use this tool here to create a game with we have time with sprite kit which is the built in a game framework from Apple but for now let’s make our simple single View application which is the majority of what we’re going to be doing in the beginning anyway somebody go next again just to remind you guys from a product name perspective I’ll say i’ll call this comp 30 25 and will say well call it demo to write or well maybe we should call it lesson lesson 3 maybe a longer name lesson 3 demo to write if you notice my organizational name if I put my organization identifiers calm that aqua tech let’s just say I use a dummy identifier and it says the bundle identifier gets automatically done for you calm that aqua tech comm lesson 3 demo too I can design for the iphone i can design for the ipad or i can do a universal app right so if we choose iphone it does different things if we choose universal and this is why we had a different interface last week last week pointed today I do this I can also choose to use core data or not and that’s if I want to use some kind of data methodology or a model from my view and controller okay who remembers we talked about Model View controller in comp 2068 did you guys have a conversation about that not in my class but other in your class yes is that is that the I here I see the floating quotation marks lies and he mentioned a hidden gold detail so what is an MPC anyway models using controllers right yes I think you’re asking a question well it is what it is right but what is it why do we well how do we use it yeah it’s a celebration of your what you’re displaying and how you’re controlling the application itself you want separately so I’m modularizing we modular eyes right okay and if you look up the line they’ll tell you that there’s different kinds of MVC frameworks that are out there right now well Apple iOS can we design for iOS it forces you into an MVC design pattern all right so you cannot create a iphone app or whatever unless you use MVC so we’re going to be using something called a view controller and if you notice on the right hand side where it’s even snap without without controlling anything right now there’s a view controller we can drag and drop an add to our application right the model itself is this data it attaches itself to the data that we’re going to be using if you want to store something locally on my machine right very very high level so here’s objective-c instead of using objective-c i’m going to use swift it doesn’t matter you can use objective c i’m not going to program right now I’m just going to I’m going to click Next and again on my desktop here I’m going to going to when it when it actually loads I’m going to create my my program here on my desktop okay now it says hey create a git repository right on my mac or i can add to a new server and if i do that it can ask me hey where is this this server anyway right and i can put in the server address so imagine if I imagine if I did something on github like this if I want to get up and add it up repository and i called it comp 3025 lesson 3 and created an empty repository here I get a URI

that I’m sure that I can probably cut and paste my guess would be right into and of course it doesn’t work right into into Xcode but that’s how would normally work we would caught we kind of pace and I’m sure there’s a way of doing it where we can add a git repository if I want to do it on my Mac that’s fine too i can still connect to github right i can do it on my mac i can create a repository first and then when i create a repository on my mac i can use a tool that connects to to github on its own that’s fine too ok so again i have my manifest this is what my manifest would look like right if you notice it has the same pattern if you saw last time but what we do a lot of it and if you notice it automatically adds things like a view controller built in with a UI kit that we use and if you notice this is great for looking at Swift I’d like to look at Swift with you for a second because this is what a class would look like right so here’s a class we call view controller and when we have these two colons this is the derived class which is UI view controller so that’s how you do kind of like a subclass right class would be view controller right we declare a class and anything in this code block would be part of the class right and we have a couple of functions or methods that are part of this class right yes very progression so that’s an inheritance inheriting correct so when I go either call colon I can do that yes you can grow in their correct correct uiviewcontroller uiviewcontroller would be part of UI kit right and you I kid is our basic library that we take in from on the Apple iOS side right so what we’re doing here is in this class example is if you look at it and if you’ve never seen a class before from from here we noticed that uiviewcontroller there’s two things we’re doing here right it looks like we’re calling the super classes of view did load and something else that says did receive memory warning so there’s a couple of of overrides we have to put in right away and what happens is they’re done for us automatically as soon as we create our default view controller right in our view controller we do a lot of our stuff that connects to our storyboard so here’s our storyboard and in our storyboard if you notice again this is almost a squarish design and what we can do with our storyboard is we can scroll down here whether you do it by the way in Xcode 6 or whether you do in Xcode 5 dot whatever you have in front of you right I’m just curious what do you have what version of xcode 5.11 you’re going to be very similar it’s not changed all that much in terms of interface design so if i scroll down if you notice i can certainly try and find the object that I’m looking for and on the right hand side there’s different little buttons that tell me that allow me to you know to close show things like a template give my template library right here is my code snippets so i can actually down kind of drag and drop some code snippets for c c++ my core data all kinds of codes tibbetts that are pre-built and pre written for us right from Apple right even some Swift some Swift struts and subclasses even classes so if i want to write a swift class i can just drag and drop and I code snippets right there right if I want to do that if I want to create a class obviously if you look at this as the main folder here and if I right click if I say new file right I’m going to give an option to what kind of file I want well I can create a swipe file I can mix and match I can have a C++ file I can have a sea plow an objective C file any kind of file I want let’s choose Swift and press next okay well here i’m going to name the file something so let’s let’s call this my class you know for my file right as an example and then just press create and if you notice it imports the foundation for all of my Swift library that I need so this is my class they don’t have a class yet but if I want to I can if I drag and drop this thing in here I get a code block a code snippet that comes into my code for my class and if you notice it says hey my class name if you know if you look over what it says here in my in the air it says the statement cannot begin with a closure expression right and the reason for it is because I have a name and properties and methods is just a stub that it puts in there lets me to take this stuff out because

it means nothing right so my name let me just call this something that I use always is my class right so here’s my class right as an example and then my properties and methods I’ll take out for now and for my properties remember we can implicitly or explicitly declare variables and constants from my class so if i say i wanted to declare you know property one right and if i want to you know kind of explicitly declare it right then i’m going to use the semicolon or the colon and then the type with a capital right i can use a semicolon or i cannot use a semicolon that’s really up to me right now if you notice there’s a little soft color here right here’s the soft color and if you notice it says expected declaration it’s not an error it’s a warning more than anything else right error looks a little different than this so if i go equals to zero because i have to declare specifically all of my objects here’s where i’m actually declaring my first property I can also do comments like we normally do so this is for example all my properties now let’s give me their right so here’s here’s my public properties there with me what we do this together right I can put any kind of comments I like just like we do in other languages and if I use the different keywords if I don’t know what it is if I want to use capital public if I think that’s it it’s going to tell me if it’s right or wrong right so public property int is equal to zero and so far we continue right now i remember in most classes class declarations they also have constructors right or initializers so different languages handle classes in a different way let’s leave that for now let’s go and declare a subclass mission I go in and drag and drop some other stuff from here so i’ll go into sip with subclass there we go class this is my sub class and it’s teaching me what a subclass would look like here’s my name and here’s my super class right if you never knew anything about Swift and you just started declaring stuff just like this you could pretty much from from a code snippet view alone if I want to learn learn what a switch statement looks like here’s what a switch statement looks like looks very similar to what we’ve seen before I showed you this last week right so it’s really quite helpful to use some of this stuff a while statement you know and so on right you could do a lot of these a lot of the basic code snippets are here so you don’t have to write it on your own so that’s what exists in this little little when you see these curly braces here it means let me grab some some code snippets that I can drag and drop into my coat that’s what this thing is if I go to the next one right and if you notice there’s some gestures that I could add in right and we’re going to talk about this later on but if you go right to the top these are all the different kinds of controls that you can put into your into your app right if I want to search for a type of control i go to the bottom right to the bottom of this piece here by the way i can resize this the way I want by dragging this thing right the bottom and this in this IDE I can search for a button spy Go button it’ll pull up different kinds of buttons like here’s a button and it says intercept touch events and sends an action message to the target object whether it’s tapped so it gives you the what this button does because every button is slightly different right a fixed space button bar bar button represents a fixed-base item on a UI toolbar object so it gives you a little bit of history of what this thing does now if I you what you would like to think right now this isn’t a code snippet and I’m here in in a class inside a file right if I drag and drop a button in here it doesn’t do anything because it isn’t it’s not the right context right you would think you would like to set up a button just like we do a visual studio when we double tap and it creates our code stuff but not not so here we talked about that last week so let’s go into our main story board for that so I go back to main story board and if you notice there’s some other controls up here right on the right-hand side these are all this is a context-sensitive menu so if I click on any one of these things like for example in the back of the storyboard itself right I get a context property menu down here right for example it says hey this is what happens when I when I when I’m drawing this what happens when I’m when it stretches here’s my alpha value it’s

one I can change this alpha value to make a different different alpha right this is the mode right now my mode is scaled to fill right you can change this to change to different kinds of modes for your background but if I want to drag and drop a button just like we did last time I can do so and again excavators I to do something else not a controller these are the things our actual documents that you can pull in into your file if I want actual things like labels buttons segmented controls text fields where I want to enter things in I can design my UI here right here right I can say well here’s my button and you know here’s my text field and when I click my button i want my text field to have a default value and I can add that in here and say here’s my here’s my default value right and so the ants and that’s what would appear as a default in the text field you can do you can again it’s all drag and drop it like we normally are used to with Java even and with visual studio so stuff that we can still do with Xcode all the regular things again its content sensitive so if I look on the right the property menu will change according to which I’m what thing I’m tapping right depending on what I’m doing if I double tap it allows me to change values right that’s what allows me to do but I really haven’t done anything until I wire these things up into my back end so this is my back end is Mike this mike hold my view controller as an example I need to somehow wire this up if I do if I want to do a double tap it has to I have to control what my button does and it’s not as easy as dragging and dropping okay tells me the type of control how its position we’d sub we kind of went through that you had last day but really in a nutshell we can do our UI stuff here now how big do you think a button has to be in terms of pixels for your finger three pixels 30 depends on retina depends on a lot of stuff what pixels pics is a bad way to think the butter right definitely you can look at percentage you can do it look at different things what the this ID allows you to do and the great thing about this is is it allows you to when you drag and drop controls on it has a flexible layout now there’s different layouts you can choose if I choose layout to find any Leo it’s not here if i go to hear sorry if I kill this thing three co the exhaled my my filter now yeah of course there’s different layouts that you can you can actually design right on the back here some of them are absolutely outs which we never want to use just like you have on the android device android device has much layouts right there’s a relative layout and so on by default the apps you build with iOS are all relative layout they’re all flexible layouts right so if you notice even though I make it so that it’s built for my iphone right and I might have my button and maybe a kind of some kind of other device here that does something or some other kind of control and I keep adding controls by the way here’s a collection of reusable views right so if I notice I can’t do this I can’t because this is another right context where would this go probably over here somewhere right and if it’s not over there if I double tap it says defines the attributes and behavior of our usable views in the collection of you right this isn’t what I need to do here this is not a drag and drop will control the drag-and-drop level controls have a different view all together and it tells you what they can do here’s my tableview cell right which i can add in there right so here’s my table view for one particular cell and i can i can outline it I can make sure that it has a border I can do all kinds of stuff with it just like we would normally be used to an imageview what would an image you be an image right so I want to drag and drop an image on my life on the design you know as an example and it’s going to be a uiimageview that’s the type of image that we’re creating here right and of course we want to name these things right so even though we’ve dragged them in I can choose an image if I have one in my asset library which I do not have

any right now okay but what we want to try and do is we can we want to try and and create a friendly name for all these things and we can do that by again the context menu ok so the same kind of idea the challenge is what you see in front of you if you’re trying to use xcode xcode 5.11 or whatever it is is going to be slightly different than what i see like for example my storyboard is much wider than the storyboard on xcode 5.1 if you notice is a thinner if you choose iphone it’s going to work only for iphone like if you look at marks new in front of him write his story board is much smaller right size of an iphone ours if you look at Xcode 6 2 square because it’s a flexible layer right that’s one of the differences again we talked about first responder last week and if you notice first responder says what do I need to touch if I touch something when is my keyboard going up here or disappear and I can if I choose the plus button right I can choose i can add an action here’s an action i can i can mention they can kind of create an action identifier to say which one which is going to be my first responder that’s what this little button is first responder here is how do i exit my app right what do i do to leave my app how do i how do i take off from there the other one is here’s my view controller how do i connect my view controller right and my view controller of course is right here right the other thing is you can split screen on these things too right so again i can control all the things on my mic on my ID to change my screens and i can also create a assistant right if i want to or take it away right i can also add in multiple views of the same document or choose a different document of view and split screen with ok so this is it’s an important feature because that way what you want to have is your view controller on one side hopefully and you want to have your your storyboard on the other side where you can drag and drop and this is interesting because this gives you the back end of what the storyboard would look like an XML format again typically what you think about is you want to create a connection right a connection between your view controller and your main story board and each item in your main story board okay I’m not going to go much further because you guys can’t do it with me it sucks right and that’s a really sucky part about this to today right the good thing about it is I want you to see code snippets ghost code snippets is a great way to learn Swift you don’t know how to do Swift you can always learn it with code snippets even from the stuff i can i can show you and I can go through Swift today if I want to say and again who’s downloaded the book from from Apple if you haven’t downloaded the book already you should because it’s a free download with itunes right if you have an apple any kind of Apple device I don’t know what has an Apple device like hey I’m just saying if you don’t have an Apple device then what I’m going to do something putting together a little PowerPoint presentation to take that information out yet is there I don’t know she’s found a PDF yeah well we can also rent them we can I can get them from I mean I know they have some ipods and stuff like that we can try there’s a PDF i’m sure there’s a PDF you can download I’m not sure no I think it’s an ePub to get Xcode at home you can to expert at home unless you have a mac in order fee developed us one of the challenges on see on an Android you can develop on any device right on what Mac does an apple it makes you create a all your iOS and and Coco apps you have to have you have to have a map right you can’t develop on another platform natively right at least not yet right on the downside the big downside is you have to spend the money to do that Ryan some people don’t want to outlay that kind of cash but if you’re if you’re serious Apple Developer than that what they’re thinking is that you can probably you didn’t want you to it’s also i also a barrier to entry in some ways but i mean you can even develop as something as simple as a as a mac mini which is only about 5 99 I’m just saying

only because I turned away I turn away when I said it come on say it away sir well I’m not saying that you should you don’t get anything it’s a mac mini mac minis you have your own screen at home and you want to use a mac device but you don’t want to outlay the money for a full iMac or a macbook pro or a macbook air right then you know the best way to do it is to buy a little mini mac mini and the mac mini listen to go there for me i don’t want to advertise from the apple store here but we’ll go there to look at what you need there is a refurbish section there is and i was going to go there right so here’s here’s your mac mini and it allows you to connect to any monitor not just the big massive thunderbolt display right but it really is that small and it allows you to do any kind of design work even the lowest end mac mini will allow you to build simple iOS apps unless you’re going to build games and therefore you need something more powerful yes 599 which ones well no you wouldn’t it’s 549 right now yeah so that’s what it is i know you’re like five hundred dollars for for like a little device like this i mean it is a it is an i5 processor so you’re not going to get like you know it’s not that bad it does only come with four gigs of ram right and file be hard drive but again all this stuff was able to run the operating system and build your your apps and another thing we talked about last week was Mac in the cloud so if you really don’t want to own one you want to pay for one there’s other options right the refurbished section though is something that i would recommend as well like if you want to buy something if you want to buy a mac or mac for education gives a little bit of a discount but not much see it thank you and what you can do with this is now they’re not the problem with mac refurbish is I mean it’s still quite pricey but if you wanted to buy a Mac macbook air like an 11 inch if they have it in stock you can certainly click there and then it’s expensive 949 but it’s not anywhere near the price of a macbook air that’s Brian you right and you can see the seventeen percent this is right from apple and certified refurbished from Apple by the way it means it’s only been ever used for two weeks they’ll never accept their never make it certified refurbished unless it’s it’s two weeks or less that people they kind of buy it they don’t use it and they returned it that’s what the really yeah I know you’re like you know you don’t think it’s a big thing but that’s a yeah well again for if you’re truly serious as a Mac Developer then this would be a barrier to entry for you so that’s why we that’s why unfortunately for some mac developers what they do is they they do things on other devices and what they do is they use conversion software like PhoneGap and stuff like that to take apps that are written in html5 and css3 and JavaScript and convert them into native mac apps right but again phonegap and other apps like that don’t work very quickly right and they do it i’m doing right because i’ve done if your son for several months now if you do a right there’s no difference all depends too it’s about the Native art not say it depends so it’s always enough times we’re doing all this a game is going to matter but i’m building a text messaging app totally is you i notice anything in fact if anything it’s easily using millisecond cadets i’m doing so so what they’re what they’re looking at is that’s why this is why like i said last week app mac and apple is they’re trying to take that away they’re trying to kill the middleman by teaching everyone swift and that’s why the book should be free to download from anywhere if i want to download the mac the book but for today what I have prepared for you which I’m going to shut this movie down and start the new one is let’s go through some more Swift will take a short break and then we’ll take then we’ll go through some more Swift to show you what that looks like in the browser okay