iOS App Development - Beginner to Published in 2018 ✅ | Grant Klimaytys | Skillshare

iOS App Development - Beginner to Published in 2018 ✅

Grant Klimaytys, Software Engineer

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
43 Lessons (4h 54m)
    • 1. Introduction

      1:36
    • 2. How to Install Xcode and iOS Simulators

      2:16
    • 3. Setting up and running our first project (yes, really that soon!)

      4:20
    • 4. Why do you need to create a beautiful app on iOS?

      2:58
    • 5. What exactly is a beautiful iOS app?

      3:23
    • 6. Looking at Apples handy app guidelines

      5:53
    • 7. Defining a User eXperience (UX) and creating our own

      4:45
    • 8. Experimenting with Xcode 7 and Storyboards

      4:18
    • 9. Designing the main screen (View Controller)

      8:29
    • 10. Adding colour to the main screen of an iOS app

      5:31
    • 11. How to add images to navigation bar button items on iOS

      6:34
    • 12. Creating the Add RSS Feed screen in Storyboards

      15:02
    • 13. Creating the Edit RSS Feeds screen in Storyboards

      1:51
    • 14. Creating the View RSS Feed item screen in Storyboards

      3:11
    • 15. How to connect Storyboard objects to a Swift code base using outlets

      10:42
    • 16. What is a data model?

      2:10
    • 17. Understanding RSS feeds before creating the models

      1:43
    • 18. Creating the Feed and FeedItem models

      6:50
    • 19. What options are there for data storage on iOS

      3:07
    • 20. Installing an SQLite database framework in Xcode 7 from GitHub

      10:53
    • 21. Creating the FeedDataHelper class

      18:56
    • 22. Testing the SQLite database connection in Xcode 7

      9:35
    • 23. Adding a feed via the 'Add Feed' view controller

      11:47
    • 24. Explaining the table view and it's table source (UItableView and UITableSource)

      1:55
    • 25. How to create a UITableViewCell for a UITableView

      8:51
    • 26. Populating the feeds table with our cells

      11:26
    • 27. Deleting an item from a table view row. AKA - slide to Delete in a table view

      12:17
    • 28. Disabling app transport security (and introduction to Info.plist)

      2:31
    • 29. Getting our RSS Feed Items

      19:16
    • 30. Creating the cell for our RSS Feed Items table view

      11:06
    • 31. Populating the RSS Feed Items list view

      7:12
    • 32. Handling a click on the Feed Items list

      13:57
    • 33. Why we need to debug iOS apps

      1:14
    • 34. App monetizaton strategies for iOS apps

      6:00
    • 35. How to implement Google Ads in an iOS app

      8:42
    • 36. How to create an app icon for iOS apps

      4:40
    • 37. How to create a launch screen for an iOS app

      7:07
    • 38. How to sign up for an Apple developer account

      1:19
    • 39. How to set up an app within your Apple Developer account

      9:33
    • 40. How to prepare an iTunes Connect app store listing - Basics

      5:54
    • 41. How to prepare an iTunes Connect app store listing - Images

      7:21
    • 42. How to compile, sign and submit an app to the App store

      5:44
    • 43. Final lecture with 1 final task

      2:01
19 students are watching this class

About This Class

Have you ever thought, "I can't program" ?

I once thought that but I tried anyway. Turns out it was pretty easy and after a few months I became self employed as an App Developer, ramping up my earnings to the tune of $120,000 per year. 

Would that amount of money change your life?

Well this iOS course is where it starts, but only if you click the Enroll button. Give it a try, you have nothing to lose and everything to gain!

cfdb8966

********Details*********

There is so much more to iOS app development than just code after code tutorial!

That's why I created this iOS app development course! No other Xcode or Swift app development course takes you from beginner (with no experience) to published. They only show you 'How to develop an iOS app', wth no reference to all the other parts such as:

  • Signing an iOS app
  • Becoming an Apple developer
  • Installing Apple development certificates
  • Submitting an app to Apple for review
  • Marketing your iOS app through the app listing

Enroll in this course and you will learn all of the above and more!

Transcripts

1. Introduction: Hi. Welcome to this course on IOS app development where I take you the beginner or novice from complete beginner slash novice all the way to published on the APP store now No other course that I know off does this. They show you how to make a nap out one stall the bits and pieces but they don't actually walk you hand in hand right up to the gates of the APP store. In this course we will actually physically publish an app. I will show you how to code the entire app right from scratch. Assuming you know nothing about coding, I will also show you have to check out your developer certificates from apple and install them on your Mac so you can run your app, sign it and submit it to the APP stores. If you're an expert coder, this course probably isn't for you. But there might be something you can learn anyway because I also go into what makes a nap look good. Beautiful ir saps are downloaded 10 times more than average looking APS. I also go through various examples of this on the app store in a few lectures time, so sticks the Lexus. Please do follow them carefully because your success depends on it. Please don't skip ahead, because in places you might miss code that's important. Later run. And all that remains me to say is I look forward to teaching you. 2. How to Install Xcode and iOS Simulators: So let's install X Code. X Code is Apple's way off giving you the development environment to create APS for iPhone, iPad, Mac and Apple Watch. And if you jump onto Google and such for X code, simply hit the first link and then hit download at the top of that page and then you want stable release, which at this point to 7.1 point one you can view it in the Mac App store and it will open up the APP store for you. I already have it installed, of course, but this tab should say in store to go ahead, install that and then come back to this video. Okay, here I have X code opened, and the first thing we want to do is set up our simulated because if you want to run your projects, you will need to run them on a simulator. If you don't have a developer account to run them on a real device, you will need to have an apple developer account, and you'll need to pay the £70 or so per year toe have that. I'll go into that a little later on, so we know what we're doing. But for now, let's set up those simulators that's click window devices, and in here it gives us a list of devices that are currently installed on your device. Yours probably won't have any. So if you click, plus at the bottom corner click add simulator that allows you to choose a device type and an IOS version. If there are no IOS versions in there, you can press download more simulators, and it will give you a list off simulators you can download. So if you click the button on the right, it will download them, and then they will be available here. And once you've created your device, you just had create and it will appear in the list here, and that's all there is to getting an IR simulator on your Mac. 3. Setting up and running our first project (yes, really that soon!): let's set up and run our very first project, and this set up is going to form the basis of the app we're going to create. So when X Code first opens up, we're presented with this option. Create a new X Code project. I'm not going to use that for now, in case that doesn't pop up for you, Where to Click file New and We want Project. So if you hit Project, it's going to give you a bunch of auctions, the first of which is a master detail application, a page based application, single view, tabbed or game. While master detail would be slightly too much information for us because we're making a very simple RSS app, a page based application might be quite good, very minimal looking. We can also have a single view application, and this is the one we're going to start with. But before I click next, I'm just going to tell you that a tab application is one of the more standard IOS ones that you see and people understand tab applications. So it's worth noting that's an option. For now, let's take a single view and hit next. Now it asks you for a product name. So let's give it one off. Beautiful RSS feeder. Put your organization naming. Then it wants an organization. Identify Now it's important that you get this right, because when you create your developer account on the apple developer site, this bundle identify it down here needs to match the identify you specify in your developer account. So for now, you can set it as something along the lines of com dot your name or your company name. And then doctor, this name beautiful RSS feed. Then we're going to choose a language, and we're going to choose the much newest Swift. It's a lot easier to use than Objective C, and we're going to run it on all devices, the iPhone and the iPad and then hit next, and then you need to save it somewhere. So I'm just going to save it right onto my desktop. In a new folder, I will call this beautiful RSS feeder and create. You can also have source control to create a git repository, and you can put that up on a server if you wish. But for now, just click create. Once that's loaded up, you're presented with this screen that allows you to set various things inside Europe. The first thing we're going to set is deployment info. We click that down, we're going to target devices with IOS eight and above only. So this is the minimum version you will target. Okay, We're all done. Were ready to run our app over in the top left corner, hit the list of devices and select one of your simulators. I will select an iPhone six. It asks you which app you want to run. Obviously we want to run the one that's open. And when you hit play, X Code will build your app and then try to run it on a simulator. That it starts up so I can switch over here to my simulator, change the scale so we can see it more clearly. And as soon as it's finished loading, it's going to push our up into the simulator and show us what are AP looks like. And that's our app. At the moment. There's nothing really to see, but it is working because if I press home there it is beautiful RSS up and it doesn't have an icon yet, but we will set that much later. So our project set up is complete and we have an app that works 4. Why do you need to create a beautiful app on iOS?: So why exactly do you need to have a beautiful app? Well, there are millions off APS out there, and that is a problem because people will glance over your APP listing in the play store and the APP store, and they won't even give Europe a chance. Even if its got amazing features and amazing coding and never crashes, they still will glance over it. And that's why you have to make your app beautiful because as humans were very visual creatures, if we see something lovely, we will download it just to give it a chance. One of my favorite expressions that I came up with was millions of people will download a beautiful app with really horrible coding, but none will download a rubbish looking up with amazing coding. And it's true. So I've just got three weather APS pulled up here. The 1st 1 is this one called Beautiful Weather. Now the first thing that strikes me here is the icon is great. I really like the icon. It's simple. It told me what I need to know down here in the screen shots. It's good, but it's not classically beautiful. There's too much going on everywhere and we'll get into the meat and bones of why too much is a bad thing a bit later on, then next off got BBC weather. Now this is not necessarily beautiful. It's getting there, in my opinion, but the one thing it does well is give you the information you need right away. Then, in my opinion, the next one Yahoo Weather is the winner because it tells me what city I'm in using a landmark picture that's pulled from flicker and it gives me the temperature off that day. When I look up, whether those are the two things I want to know, I want to know the temperature where I am. And so if I saw this, I would say I like that that beautiful I would download it Now. The BBC weather APP does have more ratings because I believe it's been going for longer than Yahoo weather up. It's only launched in 2013 I think, and the BBC weather has access to more information for UK residents locally. However, if all things were equal, I believe you. Whoever would win this contest and indeed on the play store for Android Yahoo weather is about is downloaded about 10 times more than BBC weather, so we need a beautiful app so people download it and give you a chance. 5. What exactly is a beautiful iOS app?: So what exactly is beautiful? Well, we've had a look at these Tuapse beautiful weather and, yeah, whoever and we've decided one is better than the other. But it's important to look at why that is. And to do that, I like to use photography composition rules, and it's a great example of borrowing from a very mature industry. It's me going for probably 200 years almost and using it for an industry that's only about eight years old. So the first rule for photography is the rule of thirds. If you divide your image into nine equal segments with two horizontal and two vertical lines and you place your subject at the intersection off those lines, then it makes for a very good looking image. And so now, if we look at this beautiful weather app, we can see that they apply that to the icon. But over here on the second screen shot, the sort of apply it the first screen shot. They don't Yahoo weather kind off applies it, but they're using a different trick, and that is called balancing elements. And the reason this rule exists is because sometimes if we just had one large element and reported at the rule of thirds. It might make the whole scene feel empty on the other side. So Yahoo, weather, app, that's what they've done here. They've got a very big element and then less off a subject matter in the background. Same here with a photo of Paris. We can also have leading lines that take your viewers I from one part of the APP screen to another part. We can have symmetry and patterns and Yahoo where that does this very well. In their main information screens, you'll notice everything feels balanced. It feels for full, but it doesn't feel overwhelming, and that's because they put symmetry and patterns as humans. We like symmetry and we like patterns. You can also have a viewpoint. So some kind of perspective and again with the Yahoo app, we have the text in the front, which gives some perspective to the background or rather, the other way around. The background gives perspective to the temperature. We can set a background and that's what Yahoo weather does. We can set a depth and again here we can see slight fog, giving it a three D sort of depth. We can frame it well. We can also crop things to get the viewer's eye. So of course, none of these are steadfast, but there are a great place to start if you want to make really good looking maps. 6. Looking at Apples handy app guidelines: So let's look at Apple's design guidelines, and this is a document they call the human interface guidelines. And it provides everything that you need to know about designing apps for mobile size screens and, indeed, for iPad side screens. And this is something that I use all the time. I use it in Android APS as well, because it's perfectly relevant that the first thing you'll look out in this document is designing for I us. And they give you three important rules. I asked, embodies the following themes. Deference, Which means the you. I only ever helps people understand content that's contained in it, but it never competes with it, so it's not overly flashy clarity. So if you look at this weather screen down here, I can see exactly what temperature is that I need to know and finally depth. And you might have seen this on various IOS apse, where they have a blurred background and that tells you the foreground is more important than the background. And of course, there are many other at sections in these guidelines. It's about 200 pages long, and it tells you all about the app anatomies. So what a navigation borrows a tab are toolbar buttons and alerts. It tells you about making your app to be adaptive for various sizes off device. So when you rotate your phone, your now in landscape mode, how does Europe look then, in I asked, You can prevent your app from rotating to landscape and only have it in portrait starting and stopping. What's the first experience your users will come across when they open your app, Apple says here, If you tell people to reboot their device after installing the app, then you have problems because the user probably won't do that. And they'll just uninstall your app because that takes a long time in the app world. Then we look at navigation and how IOS handles navigation and in the following section on UX design, I'm probably going to have a look at this so we'll go more in depth. But there are various design patterns for navigation that I asked implements. Then we want to look at interactivity and feedback and to imply that something is interactive shoes what's called a key color. So here apple tend to use blue, and I know if I press these key colors, something will happen. Therefore, I don't actually need to have a border around a button to signify it's a button. The color does all of that for me. And then finally, animations should give your user information or should imply what's happening next. They should never override the content and looking at branding. Look at Apple's recommendations here. You should never explicitly show your logo all over the place. You should subtly hint it it. It's OK to show your logo on the home screen in and out of the way manner, but don't plaster it all over Europe pages and then, of course, color. That's very important. If you're going to use multiple colors, then you have to make sure you use something called a color wheel to ensure that they look good together. You also have to be aware there are a lot of color blind people, and two of these colors, if it is black and white, might look the same. And then, of course, icons and graphics deserves its very own section because your APP icon is free marketing for your app, and people decide to download your app first, based on the icon and we look at terminology and wording, and it should be clear. Wording so scheduled here with its button tells me immediately to schedule this or not schedule it. It's very obvious, and part of that is in the word. So if my word here had bean schedule without a D, it becomes slightly ambiguous. I'm not quite sure what it means and finally integrating with I us for the design basics, they say to use standard you elements correctly, and there are ways of using these elements, and you have to be sure that you'll follow them. So in the future, when we have an upgrade to devices or operating systems, they will always work well. And your APP will look like it's apart off that new operating system on the human interface . Guidelines carry on going into design principles like aesthetic integrity, consistency that's important manipulation, feedbacks, metaphors and user controls. And, of course, there are many things you can click down here, For example, you elements. So if you're wondering what sort of control you need or what it's called, this is a good page to have open because you can look them up. So a navigation bar tells you exactly what it is 7. Defining a User eXperience (UX) and creating our own: so the user experience. Now this is a subject that confuses a lot of people, and I can understand why, because there are a lot of complicated sort of definitions out there about it. But in the end, user experience design is best explained as usual by Wikipedia. And it's this paragraph. I'm going to read you. You e, D or X'd is the process of enhancing user satisfaction by improving the usability, accessibility and pleasure provided in the interaction between the user and the product. That is the only line you need to know for user experience design. We are trying to make people happy or to have an emotion when they use our product, and that is user experience. And the confusion comes when people look at diagrams like this done by international architects. And right in the middle is the user experience. Surrounding that are a whole bunch of other factors based around technology, logic, design, communication, business and business logic. And it's when these come up that it gets very confusing. So for now, I just want you to remember that first line, improve the user satisfaction and to create a user experience design. There are many Softwares you can use. Simply search Google, and you will find a ton of free ones and paid ones myself. I like to do everything on paper at first and for the app that we're making the RSS feeder app. It's very simple, so we only have to draw three or four screens to design. Are you X? And here we go. Here's something I've just thrown together. I have a main screen on the side here at the top of the screen. I have the navigation bar, and if you want to know why I've drawn this there, it's because I've looked at the IAS human interface guidelines, and that's what they say you should do. One of the buttons at the side is a menu button will get into what that does in a minute. And at the other side it's a plus button, because in your RSS app, you want to add some RSS feeds, and then we have a list off feed items down here, and when you click one of them, it will open up in your screen. So, first of all, I'm going to remove this and show you the ad screen so When we click, add, it pulls up. This screen allows us to put a name in and an address and add the RSS feed. You'll notice this doesn't look very good at the moment on. That's because user experience at the beginning stage is all about the flow off the APP. Then, if I click one of the items inside my RSS items list, I want to pull up this screen, which actually opens the Web page associated with that item. And we don't have to worry about the format off the Web page because it should detect were on a mobile device and do it automatically. Finally, when I click the menu button at the side of Main year, it's going to open up this customized screen that allows us to edit RSS feeds. We have active and perhaps to select particular RSS feeds so that the list in the main screen only shows new stories from that feed we have selected. You'll notice there's an IOS design pattern here, and that is this back icon that is on all off these screens that allows us to go back to this main RSS screen, and it's an eye us design pattern, and it's one that people have come to expect. So in that very short amount of time, we have completely designed the U X off our app, or at least started to. As we go through the course, we will split the U X up into the you I design to make it look even better. 8. Experimenting with Xcode 7 and Storyboards: Let's see how we design graphical elements into our app. Open up your project in X code and then over on the left hand side. Tap main dot storyboard and you'll notice we have a square screen that pops up. And, of course, our devices tend not to have square screens. And we can change that to something we might recognize. And to do that come over to the right hand side and at the top where it says, Show the attributes, Inspector. Click that. And then before we get to see the thing that we need, we have to click this top bar in our view controller here. Then it gives us these attributes we can change, and right at the top, we can change the size to iPhone 4.7 inch, which is the iPhone six and six s. Of course, we can look at iPad full screen and all different devices that apple produce. Okay, In our storyboard, we have a bunch of views and view controllers. I'm rocking to go into them in this particular lesson, perhaps in the upcoming ones. But for now, just know this is a main screen that's going to display in your app and into here, we're going to drop various objects that we might need. So come over to the right hand side and click the Objects library. And then in here we have various items that we can drop in like labels, buttons, segmented controls, etcetera. Just a word of warning. If you can't see this, uh, column on the right hand side, right at the top. Here you can Tuggle. It's display. So just a nephi I and it's the same for the left. So coming back to our properties, or are objects rather, let's drop in a switch, drag and drop somewhere into our interface. And now we have a switch just out of interest. Let's play that and see what it comes up with. There we go. We have a switch that we can click on and off inside our simulator. So stop that running. That is the basics of how we create you eyes in I us. We can create a U I inside code, and sometimes that can be an advantage to do. But for this project, we're going to mostly stick to these storyboards. So let's drop in, say, a text field dragon drop and put it in there. And when you click on the text field, it brings up the attributes inspector on the side that allows you to change things inside this field, things like the placeholder. So we might say in a placeholder, enter name. And that just gives the user a clue as to what they have to do inside that box. We've got a clear button so we can have that appear whilst we're editing. And then if we come down to our objects, we can add some other things, like a slider or a progress view. It doesn't matter which I'd like you as the student to go through these various objects and drop them into this view. And then I want you to just play around and get a feel for the kind of things you can do in I o us. You may already recognize these elements from APS you have on your phone in the next lecture. We're going to clear all of this and we're going to get on and create the main screen off our app that holds all of our RSS items. 9. Designing the main screen (View Controller): if you have some items left over from the last lesson, I just want you to select them, press backspace and remove them from our storyboard. Just before I remove this one. From this view, I want you to notice Over on the left hand side, we have a layout map off our view controller scene, and that tells us we have some guides. We have a view which is in the center, and we have an object that allows us to enter a name. So later on, that's an easy way to find the things that we're looking for inside our scene. So delete this final item and we're ready to create our main screen. Okay, let's refer to our UX design document. It's a big fancy name for a simple drawing, isn't it? We need to look at our main screen. The first thing we have on this screen is this bar at the top. That bar is called a navigation bar, and we can see one here navigation bar. However, to use the navigation bar first we need to have a navigation controller, and that's up here. So what we're going to do is drag that onto our main view and soon out a little bit. Then grab your view controller, the original screen. I just drag it out the way a little. Now you'll notice to the left of the view controller. There's an arrow going into it, and this means this is the entry point to this scene. And if you click it over here on the left, says Storyboard entry point, we no longer want that as our entry point because we need what's called a navigation controller to control, showing new screens on and showing new table views and Web views and things like that. A view controller cannot simply do that by itself. It needs to have a navigation controller sitting underneath it. So let's remove that view controller. Let's click it and press backspace. And now it is gone. And now we have a slight problem, because in this scene there is nothing that is the entry point. So when your app fires, it won't know where to go first in this scene, and we'll get an error. So let's put one in. Simply click your navigation controller and in the properties panel on the side, scroll down until it says here in view Controller is initial view controller and simply click that on and save. Let's run it in our simulator, and when it runs, you'll notice. We're presented with this with root view control at the top and a bunch of cells inside what's called a table view coming back to Ex code. I'm just going to stop that. What's happened is it has come along looking for this entry point. It's found a navigation controller. The navigation controller has presented the first view controller that it has in its hierarchy as the first thing we see. So in I us, the navigation controller sits in the background. It's never something that we see. It's something that controls other view. Control is like this one, and we're going to come across this concept off the view controller and navigation time and time again. Now, in case you're watching this, an ex code has changed somewhat. If you get just a plain view controller in here on this navigates from the navigation controller and it doesn't say table view in here or prototype cells, then what you should do is you should remove all of your view. Controllers like so come to the side and drop in a table view controller like that, and then you have to connect the navigation controller to the table view. So press control on the Mac. That's not command control. And whilst pressing control, click on navigation controller and drag over to table view and many will pop up asking you how you want to define this Segway as Segway simply means a transition between different views or controllers. We want this to be the root view controller, so click that one now Our APP knows when it fires up, Use this navigation controller to open up the table view controller. If you're wondering what the difference is between a table view controller and just a regular view controller, have you control it simply contains a bunch of elements, and at its base there is no objects. There are no object stored inside it. A table view controller. It's a special subclass of a view controller that holds a U Y table view, and that allows you to do various extra special things without having to create your table view in code. So that's why we're using it here. The table view will hold RSS feed items. Eventually, the next thing we have to do is set the title off this view. So if you click on the few, come over to the Attributes section, you can set the view, control a title as something appropriate, and we will call this feed items right. Let's hit play. And that should look a lot better on our iPhone now and immediately. We have a problem. There is no title appearing, so let's come back. Stop and fix that. And this is something that gets a lot of people. They think they've set a title, but they haven't. They've set it in the wrong place. What we have to do is click our table view view controller. Double click it. It'll zoom right in and then click this bar at the top, which is our navigation bar. And then we want to set the title inside there, so we will say feed items. Now when we play, that should appear inside our app. There it is. So just be aware there's a difference between the title of the View controller and setting the title off this navigation item coming back to our UX design. We need two buttons at the top, this menu button and this ad button. So in our storyboard, let's scroll down in our objects and where it's his navigation item just below. There, we have a bar button item and click and drag it to up there and click and drag another one to the other side, and these are called you. I borrow button items and then click each item and have a look in the properties, and it will tell you what the styles are. The system item, the title, the image, etcetera. If I click image down, it doesn't present any images to me, and that's because I haven't created any yet. Also, the title could be changed. So for now, let's have add on the other side. Let's have menu in the next lesson. We're actually going to create the icons for this. But before we do that, we have to create the overall theme off our rap, which in this instance refers to the color off our app 10. Adding colour to the main screen of an iOS app: Let's talk about color. Color is very, very important. If you have an iPhone, you'll know that blue is the iPhone color. All of the menu buttons are colored blue. Now we want our app to stand out from the iPhone system, so we're going to come up with our own color scheme. If you jump onto Google and search for cooler wheel. K u l e r. You'll pull up the adobe cooler wheel, and this is a fantastic tool for finding complementary colors, so I can click and drag the tool. I can have a monochromatic I can have analogous. I could set them all like that. Now the idea behind color is to have a simple color scheme and probably no more than two or three colors that run throughout your app. Off picked this color this green and this purple, and they complement each other very, very well. And I know that because my other tutorial on you to me on creating APS or at least one of them is about creating beautiful android APS, and that app uses these colors as well. So I'm going with a consistent theme across all of my similar APS and that way is how you start to build a brand for your raps. People that recognise thes two colors will know that it's your app. So let's work on putting these colors into our AMP. So this hex code is the basis off this color 7 to 4 e nine c, and we're going to put that somewhere into here to give us an overall theme. And the way we do that is by selecting our navigation bar inside the navigation controller coming over to the right and down here, you'll notice we can set our bar tent. We can also set title funds, title colors and various other things. You can also have an image as the background of your bar, if you so wish. But for now, let's clink the tent bar down and let's click of them, and it will pop up with a little widget that allows you to choose certain colors. Then click the second icon RGB sliders, and make sure our jewelry sliders are selected. Then you can simply paste in your hacks color press tab, and it does the rest for you when you close that you'll now have a tab. Are that is the color off your theme now. I could either at my green colors to these buttons, but in my opinion, that would look really garish. Instead, I'm simply going to make everything colored white up in this top bar. And again, this is very confusing for a lot of people. I even have to recheck this because it's not obvious. The way we do it is by clicking on navigation bar and coming over here, where we set Barton before. Below that set the title color to white color. Now, when you scroll across here, it's still going to be black. But when you run the app, it's going to be white, and it's a very frustrating sort of bug that's in X coat. So don't worry. If you change it here, it should be white in the APP. Then we have to set the tent off our button items, so if we scroll down, we have no such thing to set here. So let's click on the bar of feed items, and indeed, the individual button items here. Then we can set a tent for each of these off, say, a white color, and this one also over white color. Now let's run the up and see what that looks like. There we go. We now have our two buttons and our title in white with a list below it. That's perfect. That's looking much more like the APP has been designed deliberately just by changing one color. Now the other color, the green one that I chose. I'm going to use it toe add light hints throughout the app. Very, very light hints like buttons on the screen or divisions between various cells. So let's stop that running. So that's the basics of how you select a color scheme and also how you apply it to the main U Y elements off your app. If you were on Android, you could set those colors in one line in one place on your app, and your android system would automatically use those colors for certain elements that somewhat exists in I us. But it doesn't exist anywhere near the extent that it does in Android. So for now we're going to have to use these colors manually with each item we want colored 11. How to add images to navigation bar button items on iOS: Let's look at how to put images into our laps. Now with IOS devices, we have various screen densities. We have one times two times and three times, and I'll explain what those mean in a minute. But it basically tells us we need to have three lots of images in order for those images to look sharp on each kind of screen. So let's add a set of images to our app. Click on the main folder, right click New File Asset Catalogue. Click next and then let's give it a name. Let's call this ad dash, Icahn and click Create and it creates and you ass it for us. At the moment, we have nothing inside that ass. It so copped the top. Go to editor, add assets and new image set. Now we have a bunch of images, and what we can do is we can assign an image to each one for each resolution. But before we do that, we need to decide what size of image we need for these plus button and this menu button. So I've pulled up the human interface guidelines, and those buttons are called to bar and navigation bar icons And if you look at the top off this document, it tells you the iPhone six is have three times the resolution. The older iPhone six is have sorry. IPhone plus have three times, iPhone six has two times and the others have two times and the older iPad two on iPad. Mini has one times, and then, just below that, it tells you what size and pixels that corresponds to. So three times 180 by 180 and one times is 76 by 76. So for our icon, we need Icahn sizes that are 22 by 20 to 44 by 44 66 by 66. So we want the same image, but in three sizes. Once we've created those, we're going to drag him in here and to create these images, have made a quick mock up in photo shop off my ad icon, which is sitting at 66 by 66 pixels, and my menu icon, which again is 66 by 66. I've put a dark background just so we can see it clearer in this tutorial. If I switch that off, that is the final image that we want to save as well as the ad icon. Bear in mind buttons support transparency. So you should save these files as Dr PNG's. Now you would have to say this foul as a 66 44 22 and you'd have to drop those, respectively. Into here I have this fantastic bit of software called Asset Catalogue Creator. I think it was 2 99 and all I do is I dropped a single image in and it creates an image set on I us for me, which is great, So I'm just going to do that now. Then I'm going to drop my icons into my ex code project at one times going to have two times and, of course, three times like that. Then save that and let's come back to our main story board. Let's go over to add, and when you've clicked it, you'll notice you have an option to have an image over here, and I went to Click Image. Now this is called image and not add icon dot exe cassettes because in here it is still default named as image. So what we can do is we can click over here and we can change it to add dash by con and then over here in ad dash icon, dash dot exe cassettes. Let's change this to images, not X cassettes. And that more matches the default naming conventions in i us. So if we click on our main story board, it's disappeared because it doesn't know where to find it. Let's hit at Icon and there it is. And let's do the same with our menu icon. So click on images dot exe cassettes go to editor, add assets new image set and let's call this menu icon. Then let's perform the same steps to create our menu icon, which is there. So I'm going to say that as a PNG menu icon and cold, it's a PNG. Then I'm going to use my bit of software to create the images, and then I'm going to drop them in two X Code so three times, two times and of course, one times. Then I'm going to open my main storyboard and set it the menu image as Manu Dash icon. And now when we run that we should have something that looks a bit more like something we expect. There we go now These I can't seem a little bit small. However, I don't mind that because I don't want the focus to be on those. Aikens. I want the focus to be on this content area here. 12. Creating the Add RSS Feed screen in Storyboards: Let's create the add RSS feed screen. Open up your main dot storyboard and drag a new view controller into the scene, and then you'll notice this view controller has no property set for it, like the colors off the items at the top. That doesn't matter. We will come to that. The first thing we have to do is we have to link from the feed items menu button, or rather, the plus button to this view controller up here. And to do that is very simple. We select the plus button, hold down control and drag from control over to the view controller, and it asks us for a Segway. Do you want to show show detail, present mode early, etcetera. We can also do push and model, which are now deprecate ID. So don't use those. Let's to show. And let's run that to see what it looks like Now when I hit, plus it opens a new screen. You'll notice the bar at the top stays the same color. However, we have a slight problem in that. This back arrow and this title are all colored blue, which is the default. So let's go back and change that, and the first thing you'll notice is that it has now changed to purple at the top, because when your at builds, it tends to update all of these things. So click your view controller at the top and over in the attributes. Let's change the tint to just white. Let's run that. And that should make everything white inside that section. So hit plus, and it hasn't now. This is a tricky one for beginners, and it took me a while to get my head around Exactly what I asked is trying to do here. And really, it's not I us. It's us as developers, because if we look over here and attributes, the view is actually background and tent properties. So we're only setting the properties off this white area, and I'll show you that by just setting a background color toe like gray. What we have to do is set the properties off this top layout guide, so let's click Top Layout Guide over in the left click on the first icon, which is File Inspector and Down Under Global Tent. We went white, and now when you run it, everything should be colored white as we expected to be. There we get so come back and stop it. Now, as this is an ad, feed our assess screen. What we have to do. Let me just zoom in a little here, so you can see is add some U Y elements that allow us to enter a name, a Web address and a save button, and the first thing I want to add is a text field. So click and drag a text field into the view and then tap on the text field and let's give it some properties over on the right. Let's give it placeholder text. We will call this feed name and then we want to change some things, such as the width of this and where it is relative in the screen. Because bear in mind, we are designing for different devices. But luckily, X code gives us the options to move these things around, according to the screen that we're using. And to do that, we use what are called layout constraints. Now, I've just got some constraints left over here, and I'm just going to remove them because they're not supposed to be there right, so constraints position elements relative to one another or relative to the screen. And it's important to know that inside this view in X code, it will not show you what the what your final you I will look like unless you manually updated right. The first thing you want to do is take this feed name and give it to size. Now most people would come over to sort of the attributes inspector and the size inspector , and they would changed in here. But that would cause a problem because it wouldn't update the place you change. The size is down here on the right, this square icon. When you click it, you can then put your constraints into here. So let's give this a width of 200 click the width box and the height books. And then that's click. Add to constraints. Now you'll notice it has gone red up here, and that's because we haven't updated our view so again, come down here to the triangle section and click Update frames, and now it's placed it in the correct position that it thinks it should be in, and you'll notice that has gone off the screen. So Let's expand the feed name over here and have a look at these constraints of our with and our height off 97. So, as I promised, in this course, I take you through the warts and all of development, even though we typed in 200. At least I'm pretty sure I did. It's come out is 97. So if you tap the constraint itself and come over to the right hand side toe attributes or the size constraint, you can change it to 200 then come down out. Sorry, select the feed name. First, click the triangle at the bottom, and then we are going to update the frame. Now it puts it wider, but still, we have a problem. We need to move this into the center off our view and just a little bit south off this tab at the top so we can do that in two ways. We can come down to the bottom and click new alignment constraints, and we can center it horizontally in our container. Let's try that. Okay, it's updated, and there it is, smack bang in the centre off our container. Now we can also apply constraints by clicking by holding control, clicking the object and dragging it to the view. And it will give you a bunch of options to apply constraints there as well. We're not going to do that for now. Instead, we're going to click, control, click and drag up to the top layout guide and click Vertical spacing and inside there were going to have a constant off about, Let's say, 20. I'm just going to, of course, update everything. If it allows me, I think you have to click feet name. It's probably because it's already updated, right? So now when we play this in our iPhone six, we should get something that is smack bang in the centre and 20 points below the top item there, and that's perfect. It stopped that. Then let's do. Let's add another text field because it's good practice to do. And this text field we are going to a sign, a placeholder off Web address. There it is, so he won't feed address, and then we're going to add some constraints to it as well. So down on the bottom bar, when you give it the width of 200 and a height of 30. That's what changed 200. Add to constraints and then, of course, update frames, and you'll notice it's popped it right at the top here. So let's continue adding constraints. First, we want horizontally in container like that, let's update again, and then we want it below this feed name. So if I just select the feet address box, see if I can drag that down. I don't think I can. But let's control click and drag. It's to feed name, and we can have some vertical spacing on this. So hit vertical spacing and then adjust that vertical spacing to, for example, minus 66 well minus 76. There we go, and let's run that. Make sure that looks good, which it should do. There we go now. The last thing to add, of course, is a button, so save what you have so far over on the side. Here, click your button from the objects and drag one into the scene, and the first thing you'll notice is the text goes away. And that's because the default text color is actually white. We're going to change our text color for buttons to the green that were part that was part of our app scheme. So I come over to my attributes, click text color down, others are to be slide is. And then before I do that, I was going to drag that in there so I can reference it later. Put my green one in drag that into and clothes and there's my button color. Okay, then we can change the front of our button so we can increase the size of that front and we can change the text on it so they will call this safe. Then we need to add the constraints, of course. So first we want a width and a height. Let's have a width off about 100. Let's update our view and you'll notice the save button has disappeared. If you click it over here on the side, it should appear again. Let's add our horizontal and then let's also add and lay out below the feet address. So vertical spacing and what we want to do is just change that to maybe minus 80. Then let's update our frames and there we have it. I think I will drop that down just a little bit more. It's have this on minus 120 and there we go and in fact, something to drop this top one even slightly more. Let's have this at, say, 40 and let's play it to see if it looks balanced. Because if you recall, we're using photography rules somewhat in our app. So when I see that it still doesn't look quite right to me. So what I'm going to do is move things around a little bit more me to drop some more space from the top. Let's make this 70 and then they save button. I'm actually going. Teoh change this constraint to perhaps 60 note that looks a bit too much. Maybe 70 or 80 and now for hit play. That should look a lot more balanced, which it does. In my opinion, however, it doesn't quite feel finished on. I suspect I know why, and that's because we're using the plane textile of buttons here. I think I would like to swap this around. I would like to have a background of green and a button of white, which would match all of the other button colors inside of our app. So let's have a text color changed back to white color, and then we need to set the background at the moment. It lets you set an image. We don't want that. We just have to find the background, which is down here. Let's have green there. That looks slightly better to me later on. We can also change the curvature of the edge of buttons to match the text up here. But that will come programmatically. Let's change that front and take it down a little. That's better. Okay, and now when we play that it should look a lot more balanced and a lot more ready to do what it's supposed to do. I like that. No, that does sit well off course. It's up to you wherever you put these things. But whenever you're designing your raps, you need to have an eye for how they look 13. Creating the Edit RSS Feeds screen in Storyboards: Okay, let's create our edit RSS feed screen. Now, this screen is going to be a list of the RSS feeds that we currently have stored in our app to come over to your objects and let's look for a table view controller and drop that in to our scene. And then let's select it and make sure our tents and everything are correct. This view controller is going to fire up whenever we press this button up in the top corner , the menu button. So press control. Click on the button and drag it over to your table view and the action Segway will be show . Okay, that should have connected up. Let's hit play and make sure that works. There we go. And now when I hit the menu button, it opens up our feed. Our feeds. Okay, stop that Running. That was pretty easy, wasn't it? Once you get used to this idea off the interface builder, everything becomes really simple to do later on. I haven't covered it yet, but we're going to look at these cells at the moment. We have prototype sells much later on. We're going to define these cells programmatically so you have a much better feel off what I us is doing in the background. 14. Creating the View RSS Feed item screen in Storyboards: the final screen we need to add to our app is the screen that allows us to view the full RSS feed item. So come over to objects and let's grab a view controller and put it in to our view. Now we're not going to link this up to anything right now. We're simply going to populate it with some bits and pieces that we need over in objects. Lex rolled down, and we are looking for something called a Web view, and there it is and, it says, displays embedded Web content and enables content navigation. This is very useful because it allows your user to browse the Web without leaving your app , because if they leave Europe, chances are they won't come back. So let's go ahead and drop that Web view into our view controller. And that seems to have not worked. And this is something you have to be aware of in the in state interface builder. First, you might have to zoom in on the Web controller just to stop accidental drops. Now, when you drop it in, you should have no problems. Okay? We need to set some constraints for this, so let's have a browse through our constraints. Down here, we can align things, leading edges, trailing edges. Let's have a look at the next one. At our constraints, we can give it a width and a height, but in this case, we wouldn't want to give it a width and a height. What we want to do is give it a constraint to the edge of the screen to the other edge, the top and bottom. So is that it completely fills our screen. And let's do that by holding down control, dragging from the Web view to the view and then pressing vertical spacing to top layout guide. And then we will make that a constant off zero, and we'll do the same with the lower section, the bottom layout guide, and we will give this zero as well. And then, of course, we can do the same to the sides on both sides, and we can select these items here in the tree, view zero and seeing room. Then let's update the frame and the Web view expands to fill our friend. So say that Okay, we need to connect this somehow to our table view, So when we click an item. It fires up this view controller and we're going to do that a little later on in this project. We might do it visually and remind do it programmatically It depends. 15. How to connect Storyboard objects to a Swift code base using outlets: sen al it. We have all of our G Y elements set. We haven't actually done any coding it. And this is the place where we start to connect this story board and this interface builder to our actual code base. And we do that using things called outlets. But before we go into outlets, we have to physically connect each of these view controllers to their own class on the way we do. That is by right clicking beautiful RSS feeder going to new file and then up in I us. We'll go with source and we'll go with a cocoa touch class click. Next, give the class and name. This is the one we're going to use for our feed items list view. So feed items. Then we're going to give it a subclass of a U I. Table view controller and you'll notice that it depends your class name up here with table view controller. So you know what it's for. Okay, We want our language and swift. So leave it is that Click next and drop it into our project. And now we have a look at our first code and all this code does is create a class off type you white table view controller and implement all of the methods that we need for that class. It also comments some out so you can have them in later if you so wish. Okay, now that we have that Klaus, we need to attach it in our main story board to this table view, which is the 1st 1 called feed Items. Then select this icon at the top here called feed items. And over in this panel select this icon called the Identity Inspector. And then you have to assign a class, and the classes that you have in your project will come up here. So here's our feeds item, table view, controller and press enter. Now those two items should be linked. Let's do the same for this table view controller, which is actually going to show us our feeds. I'm just going to change the name of it. So I go over to attributes and give it a title. And this is feed list just for us to know which controller we are talking about. Okay, we need to create over here in beautiful RSS feed a in you file cocoa touch class. And as before, we weren't a table view controller. And this is feeds table view controller. Click next and create. It will open it up for us. Go back to your main storyboard and click your feeds list of the top. You can also select it by coming over tea here in feet bliss scene and selecting the orange icon. Come to the class in debt Identity inspector, and we should have feeds tape of you. Control it and save that. Then let's come up to this view controller, the one where we add our feeds. So in beautiful RSS feta that's creating new file Coca Touch class. This will not be a white table view controller. This would just be a U I. View controller and we will call it and feed view controller. Click next and create. And let's link that up like so. And finally, we need to link up this Web view controller we have here. So let's create a Web view controller, Web view controller next, and create back to our storyboard. And that's length um, Web few controller. Okay, that is how we connect our interface builder on our storyboard to the actual code that tells us how to or what we're going to do with in our out now. We also need to link things like these buttons and these text areas to those code classes. So let's do that. Next, Select your view controller and then at the top here, where you see these linked rings. It's called Show the assistant Editor. Click that, and what that does is that shows the class that we created to link up to this screen called Add Feed View Controller. Let's create a little space at the top of it here and then over here, let's start dragging things over. So feed name. I'm going. Sorry, not dragging. That's my fault. Just going to undo that. Let's control click Rather, and then we drop it in here and before I let go, it says, insert outlet action or outlet connection, and when I drop it in, I just want an outlet will get onto actions in a bit, and we have to give this outlet and name. So we were saying Name, label, and this is a you I text field and will leave the storage as weak and click connect. Now those things are connected. So in here, every time we reference name label, it will come and refer to this one in the designer. Let's do the same for our feet address. So let's drop it in. Let's call this address label and connect, and then finally, let's drop in our button. This is going to be slightly different because what we want here is we don't necessarily want to touch the button. We actually want an action to go with the button. So hit action. And then we have to give a name for the action. So save button click, and the event is going to be touch up inside in, I asked. There are many, many events for buttons where we can drag. We can start by touching up outside the button or inside. Usually you're going to use touch up inside for the arguments. We don't really need any because we know what sent us. It's the button and click connect, and now we have our save button click. And in fact, I'm just going to move that down to here a bit further down. Okay, now everything is connected. We're just going to test that out. Check it all works. So inside save button, click. We're just going to change the name, the text inside name label said. We will have name label Don't text equals two Hello world in that great programming tradition and save that. Now let's run it and see if that works. So let's add Click Save and it has worked. So everything references. And so in Hello world, I can change it around. If I click save again, it'll just replace it. Excellent. So just to summarize, whenever you have a storyboard, you first have to create the view controllers toe a sign to these graphical elements. Once you've done that, you come up to the top right and show the assistant editor, and that will allow you to drag over the G Y elements into your app or rather, control click and drag. Okay, inside here. Let's just remove hello world because don't want that to happen over and over again and safe. Let's remove that Assistant editor. Let's have a look at anything else we might need inside the table views. We probably won't need to access anything, so we don't have to use the editor for those. However, inside the Web view controller. Chances are we will have to access this Web view. So select the view controller. Open up the editor and again, let's control, click and drag into here. Leave it as an outlet. And let's just call this Web view and click, connect and make a little space. Okay? And in here it's generally a good idea to reference up, to comment. All of these, let's say Main Web a few and save it. Okay, that concludes, connecting everything up inside our interface builder. 16. What is a data model?: data models, often the source of confusion for a lot of programmers. I'm going to explain them very simply, using just Lego. Let's say we have four Lego or five Lego blocks here, and each of these blocks is virtually the same thing. If I want to store those in a program, I construe or them as, say, a string or Boolean or an interview. But if I have some round Lego blocks that are of a different type to the square, Lego blocks been, storage becomes a little more complicated. And what happens when we start adding more and more types of things? Well, ideally, we'd like to group all of these into what's called a data model. So a data model holds all different sorts of data inside one container. That's all a data model is now. If we're going to use a real life example off a data model in action, let's look at our own species, the humans and in particular, let's look at human characteristics So our data model would be called human. An inside human. We would have various properties such as walking upright. We would have tools and food bodies, social life, language, and symbols and brains. You can see how in the object oriented world, storing all of these variables would be very difficult if they were just by themselves. And that is why we use a data model to lump together different variables that define a thing such as a human. 17. Understanding RSS feeds before creating the models: to create our RSS feed models. First, we have to understand just what an RSS feed is, and I've pulled one up here, which is the RSS. Feed off the BBC World News and Firefox, which is the browser amusing, has formatted it into links and dates and descriptions. But if I look at the source of an RSS feed, it's actually just a XML document with a tag off our assess attack of channel at the tag off item. There is a lot of other information inside off these tags, so we have to know which ones will always be there in order to create our model. If we look at the RSS specifications in at the half floor website and we scroll down, it tells us there must be a channel. And in the channel they must be three items, which is the title, the link and the description. And then it says there are optional channel elements like language, pub, date, etcetera and then underneath channel. We can also have an item, and it says an item must contain these three things a title, a link and a description, so that gives us an idea of what we have to include for our feed items and perhaps our feed data models 18. Creating the Feed and FeedItem models: Let's create the feet and the feet. Item data models Inside Rx Code Project. Right Click on the first folder, Click New File, and we want an empty, swift file. Click Next and let's call this data models and a new file is created Now. The first file we want to create the first class we want to create is to hold our feeds. So it's just type of comment that says Hold holds feeds. Then that's created class called Feed and you're not sure what classes and objects are. Have a look at my other course on object orientation. It explains it all. Then, inside this class, I need some variables for this feed, and the 1st 1 I need is a far I. D. And this is going to be of type integer 64 and that we need an I D. Because later on, when we use databases, databases need to assign to an I D. So we have a unique way of identifying our feed that is stored in the database Now. In the previous lecture I looked, it feeds and they had a title, a Lincoln description. However, our case for a feat class is slightly different. All that we want to hold is a title and a link, not a description, because the title and the link are what the user is putting in to our app whenever they add a feed. So let's at those, let's say far and let's call it name, not title and string question. They put a capital s on that one, and then we will need on a dress, which is also a string question. Then we need to initialize this class, and we do that by typing in its question. And then I D, which is an into 64 a name which is a string and in the dress, which is also a string and then opening close our curly braces. This method is simply going to initialize this class. It's going to take in an idea, name and an address, and then it's going to assign those to these variables. So let's go ahead and do that. Self dot i D. Is equal to i d. Self dot name is equal to name itself dot address is equal to address. Now we've assigned them, But what if someone passes in a name or an address? that is nil. Well, we have to check for that. So let's say if name dot is empty or address dot is empty, then you should return Neil and that just holtz the initialization of the object. So to summarize, whenever someone creates a new feed, this method is called and it assigns and I d. A name and an address. If the name and address are empty, it will cancel initialization off the object. Now let's create our feet item object. Let's create a new class called feet item open curly brackets. And, of course, we need some properties for our feet item. We're not necessarily going to store these feed items inside the database, so we don't need an I D. For them, however, looking at our specifications, each feed item has a title, a description and a link. So let's put those in. Let's save our title would be a string and far description again is a string far link strength. And then, of course, we need to initialize this class. So we type in it title, which is a type string description which is of type string again and finally link over time strength. Then we set our internal items equal to this initial Isar. So we say self title this equal to title Self dot description is equal to description and Self dot Link is equal to link as said, and then go ahead and say Fat, you could also do some checks inside here to check of things are empty, but we're going to leave that clear for now. If it becomes a problem later, then we can always come back and correct that. 19. What options are there for data storage on iOS: in I us. We obviously need some way to store our data, and there are four general ways to do that, and I'm going to list them here in order of complexity. So the simplest one first is Ennis. User defaults in issues of defaults are originally were originally a concept to store your application settings your defaults, if you will. So if I wanted a red background, then I would use in this use of defaults. However, if I want to store a large object, say of RSS feed items, then I would have too many user defaults to keep track off. So it was too simple for large data storage. The next one I can look at is a P list or a property list, and this is in all most apple, uh, operating systems. And it's simply a list, which does a little bit more than the previous class. So groups together a bunch of default items or properties and puts them in the list. You can think of it as a simple text file. So if I was looking at a person, I would say there sweater was red. Their head was round. They had no hair that I would stall store all of those inside AP lest, however, there's a much better option for storing large amounts of data, and that is to use the court data provided by Apple. This is Theophile Shal way to store large data inside, I asked devices, However, core data is pretty complicated to use, and I wouldn't recommend it for a beginner. If we look at this coordinated description, it tells us that it interfaces directly with sq light. Now, Rescue Light is a database that it is a simplified version off, the much wider my SQL and various other databases like that. So the final further option is for us to use a library to interact with sq light. And that's where this gets hub. Library comes in sq light dot swift, and it's a fantastic library and allows you a hands off approach to doing your database injection. So if you're going to store large data and I would recommend you use some sort of escalate library, there are many of them available if you swift or are still using objective C 20. Installing an SQLite database framework in Xcode 7 from GitHub: Okay, let's install this sq light dot swift library on. Get up, head on over to this address showing the top bar and then hit Download zip on this page. Once you've done that, go over to X code. Select the top most level of your project, right. Click. Add files to beautiful RSS feeder. Then find where you've put your folder sq light dot swift master and then select the sq light dot swift dash Master Doctor X code approach and click at now down here in general, under linked frameworks and libraries, click plus and then select the correct escalate dot framework. We want the one for I us and click add. Now we should be able to access the sq light databases within our app. Once that is complete, we then need a way to access the database. So on your beautiful RSS feed of folder right click new file and we want an empty swift file. Click next and then colds. File s Q L I T E data still and click create now under import foundation. Let's import sq light. If sq light doesn't show or it gives you an error, don't worry, it is they're All you have to do is build your project once you've imported this library. Okay? Now, this sq light data store is going to allow us to directly access the database, and you can pick up a fair amount of errors when you're accessing the database. So we need an e numb to store them all. That's have Denham data access era era type open your curly braces and then in here we have to give it some cases. So case data store under school connection under school era. Then another case if we get an inset underscore era and we want the same with a delete underscore era and finally a case search underscore era. Oh, there is one more in case we have nothing that's being returned from our search. We weren't Neil underscore in underscore data. Okay, that will handle the errors as and when they come up, then we want to create our class. So, class Sq light data store and then inside here, we need a shared instance off this class and this is a singleton, which means there is only one of them static, let shared instance equal to sq light data stole that's then create our connection, which is let Bebe DP connection with a question. And then we have to initialize it so this will be private in it. Open braces and we need a name for our database. So this will be far path equals db dot sq light. Then we have to get the directories. Where are Documents? Folder is for our app. So we do that by saying, If let d I ours and this string is equal to is equal to and it's such path for directories in domains. And then we need a directory, which is in a such path. Directory dot dot document directory. And then we need two Domain Mosque, which is in its in a search path domain mask dot oh, domains mosque and a final argument off. True and close that bracket. Then type as and this strength open curly braces. Let de ir is equal to d I ours not, and this just pulls out the documents directory From what we've just gathered from this function here in a search path for directories in domains. Once we've got that, we're going to add it by saying string by a pending path component path component we go. Do we say the name of our database dot sq light, and just to make sure we have that, let's print it out path and later on that will tell us where our database is being stored. Okay, I think I have one more parentheses. Let me get this right. Okay, then, inside this private in it, we need to have a do statement where we take our database connection and we try to make a connection to the path and we have to catch under school and set it equal to kneel if it goes wrong, okay. And safe at okay. We seem to have no errors. That's great. So all this function does is initialized the connection to the database inside our documents folder for our app. Then we need a function to create the tables. Funk create tables with no arguments, and it throws and then we won't do Try and then I'm going to type feed data help. This is a help. A class that we haven't yet created. But we will dot create table and close. That ended with a catch. Putting brackets all over the place here and then inside the catch. If it goes wrong, we want to throw a data access error. Don't data store connection error. Okay, Appears have to put in extra and in that should fix it. All right, so we only have one error, but that's going to be fixed in the next lesson when we create the feed Data helper. For now, what you've creased in this lesson is a way of installing a framework toe access sq light, and then a class that allows you to get a connection to that database. And in your future, wraps using swift to you are going to use this over and over again so you can more or less use this as a drop in replacement for any future. Perhaps you create all you'd have to change is this section here, and how you do that will become clear in the next lesson. 21. Creating the FeedDataHelper class: Let's create our feed Data Helper, which is this class down here that we've specified but haven't yet created? Right click beautiful RSS feeder. Click New file and we want an empty swift trial. Click next and call it feed Data Help are this class is going to link our database with the data that we want to put into it. And the first thing we have to do is import sq light. Then we need to define a protocol. Now, protocols and swift are similar to interfaces in other languages. A protocol specifies a set of behaviors that something should implement without actually providing that implementation. So to define a protocol, we type protocol, data, help protocol. And then inside here, well, you need a type alias cook tea. Then we need a static function called create table, which throws avoid. We need some more static functions, one called insert to put our data in. It's an item of type T and that also throws an int 64. Then we need a static, a function called delete, and that will take an item t that throws avoid. Then we need one last static function, and that will be to find all of the items in our database or in our table, and that is throws type T and questions. Okay, go ahead and save that. And we've got some errors here. And that's because we don't Actually, that's because this void needs to be with a Capital V. Sorry, I'm coming from the sea. Sharp World. And there It's a lower case V right? Once you've created that protocol, let's create our class, which is the class feed data help, which is the name of the file as well. And that's going to inherit from this data help of protocol. And then inside here, we need to say, Let's let the table underscore Name equal to feeds. Then we have to do the same for a table static let table equals to table. And of course, this needs a table name. Then we have to set the I d. So static Let's I d equals expression. Give it a type which is into 64 and this is from I D. And we have to give it a name. Static. Let name equals expression. This is a type of string on this. Of course it is called name And then finally we have to do the feet address so static let address equals expression, string address. And then we have to tell it what our type is for the type alias. So we say type Alias T is equal to a feed, which is something we defined earlier. Okay, now that we have are variable set, let's go ahead and create a table. So static funk create table and you see it's thrown there for us because we have it up here in our help of protocol. And that is the first. A real advantage of protocols that we're coming across is that it pre populates this field for us. Okay, inside here code. Let's type God, let DB equals two sq light data store. That's the class we created previously. And then we want to grab the shared instance and then we need our database connection else . If it doesn't work, let's throw an era through data access era off type data store connection, error. Okay, And then, if we have that, we need to say do and then let space underscore Space equals try db Don't run. Get to run a query which is table dot delete. Sorry, not elite table dot create and then only if it doesn't exist. If not exists, it is true. Open curly braces Type T in t Don't column I de Comer Primary key And this we want to auto increment because every time we had something to our database or ah, table. We want the primary key toe automatically go up by one, and that will help us identify that item later. So put your bracket in and then we need another column t dot column, which is name, and we need the final column toe hold our feet, T dot column, which is address close curly brace and regular bracket. And then we have to finish off this Luke here. So that's type catch under school Curly brace. And then we put some kind of error handling if table exists. So obviously the first time you run this, the table won't exist. Everything will be fine. The second time we've run it, it will exist, so it'll throw this error. But that won't be a problem. As just one small error here. This primary key should be lower case p okay, and we haven't air on class feet helper, which doesn't conform to protocol. But we're going to make it conform to that after our create table. Great some space and let's make another function. And the next function is this one in our protocol, which is inset. So let's type static funk insect. And then it wants an item T, which throws in in 64 and then let's pop in our coat. So we need another connection to our database. To do that, we can just copy this line in create table and pop that it Then we need to do some checking , which is if item dark name is not equal to nail because we have to check its there, and I two dogs address. He's also not equal to nil. Then we can do something with it. We can say let inset equals to table Don't inside. And then we need to have the name set, item name, exclamation, and we need to set the address, which is provided by items dot address exclamation. Okay, once we have that, they were going to say, Do let the road I d equals. Try database dot Run inset. So we create a query here, and then we pop it into the database and try and insert that rope and the dates base will return us a row. I d If it the insert is successful, then we need to have a guard row. I d is greater than not else snatches checks the row i d is larger than zero, which it should always be for a database. Otherwise, we're going to throw a data access era called insert era. Okay, Finally, if we don't have to throw that era, then we're going to return the row. I d Okay. And then we need to end this do loop with a catch, catch, underscore, open carry braces. And if that doesn't work, we throw a data access error, which is called nail in data. And then outside off the if statement. So this one here, let me just create some space down here. We want to finally throw data access, error if none of that's works. Sorry. Have made a slight mistake here. We don't want Neil in data here. It's the wrong era. We weren't an insert era. And then down here, we want a kneel in data. Erin. Okay. That takes care of the inside function, and it's still asking for more. So we need to create a delete and a find all function as well. So I'm just going to whip through these very quickly to save some time. Feel free to pause the video and copy the code. So there we go. We have a delete. We need to access our database. So let's just copy this and then we have to let query equals table dot filter I d equals self dot i d Then we have to do that's temporary. Variable equals try database don't run and we're going to try. And, of course, delete query docked, delete. And then we have to check the return value. So God TMP equals, equals equals one else. We need to throw an error through data access era dot Delete error and we need some catch. Yeah, data access Error, Dr. Delete error. Okay, that's the delete function. Let's go on and create the find function, sir. Static Frank, find we don't actually want find all yet. We'll do that in a minute. We just want find i d in 64 throws. T question open. Curly braces. So you defined our own function here. It's not in the protocol. And of course we need to have our database connection and then we need a query. So let query equality table dot filter self daughter I d equals I d and let items equals two db dot prepare query and then for each item in items. So item in items do the following return feed and the I d will be writing and self Don't I d should be self. We need a name which will be iTunes name and, of course, an address item that rice Otherwise, if nothing exists, return no. Then we need our final find all function, which is static, funk and final and what musky puts it in for us. And then let's put our database access in, and then we need a return array because we are finding a list of items of type T Let me say let items equals two db dot prepare and table. So getting everything from a table and then for each vitamin item for vitamin items, we're going to add something to our return array. So, doctor append and this will be a feed. We're going to have item I d item name, item address And then finally we have to return the return ary and then less is correct This up here in the top line, we don't self don t we just won t And then it tells us there's an era where we have to fix it by inserting an exclamation at the end. There we go. So that concludes the creation of our feed Data helper. And just think of this class as something that interacts with the database that we can feed data into and out off without expecting any errors to crash our program. 22. Testing the SQLite database connection in Xcode 7: Let's test out our database. And because you've written a lot of code testing is mandatory. We always must test, and the ideal place to test in this app is in this file the feed items table view controller, because this is the first thing that loads when our uploads so inside are viewed load method. Let's create a little space, and the first thing we have to do is get a connection to our database. So let data Store equals two sq light data store dot shared instance, and this initialize is our database. Then we want to do something. So do try, without data store to create tables. Once we've done that, we're just going to run a little function called check database, and we'll write that in a minute. Clothes are curly braces and right. Our catch underscore Curly braces. We're not going to do anything with that catch. Now. Check database has been implemented, so let's create a new function to do that cold funk check data base open curly braces. So in here we now have a connection to our database. Let's try do something with it. Say do and then let's say let feed one equal to try feed day to help her. Don't inset because we're going toe insert a new feed and let's give this a type of feed. And then it asks us for a bunch of variables. So first would give it a int. Just make this zero. We give it a name, so we will call this feed one, and we give this an address. Just call this www Doctor one. Okay, Once we've inserted, we should have a feed one return and I d in the database. So let's check where that is on the way we do that is to print feet one, and that will tell us on the command line. If you don't know about the command line yet, we will get to it. Okay, There's a slight error here, and that's probably because it wants to insert an exclamation there we get. Then let's try do that again with feed to so let feed to equals to try feed data. Help her, don't inset. And we're gonna put in another feed again. The I d will be zero here, and we will call this feed to and www dot to and save and then Let's print out that I d feed to and save. We need to end. I would do statement with a catch. So catch under school, curly braces. And then once we've done that with printed all of that out, let's try and connect to that table we've just created with all of those valleys. And let's get them out that say, If let feeds equals to try feed data helper dot find All So we're going to get everything from this table open curly braces. Then we say for each feed inside our feeds inside our feeds result we're going to do the following we're going to print. First of all, come on back slash That's it. The first thing we're going to print is our feed dot i d exclamation. Then the next thing we're going to print is the feet name. So back slash open brackets feed dot name close brackets. Then we're going to print our feed address. So backslash open brackets, feeds dot address exclamation at the end there and there. Let me just needs in this up. Those quotes should be at the end. And this feet don't name needs an exclamation, as does the idea. Okay, that almost covers it. We just have one more area to fix. And that's the final closing bracket. Okay, so that goes through the entire list of feeds and prints out the i d. The name and the address. And then finally, we need just made a slight error. Let's put this all inside the do loop. So do in parentheses. Tabal of these over. And then we want to catch any areas that come out of that. There we go. Okay. Just got a couple things to fix. It wants us to have a comma, but that's not correct. That's just correct This line up here first. So when you're dealing with errors in an X code, should always correct it from the top line first. So always the first error because the air is further down may actually be related to that first error. And so I have a slight error here. Let's move these quotes to the end. Okay, now we have no errors. So now when we fire up our up, the first thing is going to do is create some tables, Then it's going to check the database. And when it does that first it's going to insert two new feed items is going to print out the I DS that the database has assigned to those. And then it's going to go through that table and find all of the feeds in the table, which, if we're doing things correctly, should be these two feeds. And then for each one that it finds its going to print out the I D. The name and the address. So I'm just going to hit play. It's going to build it and fire it up, and we won't see anything. But if we come back to Ex Code, we can see down here. That's from my earlier testing that it has worked. But these are the items that we've put in, so it's going to stop that way to close this output window. I'm just going to add one more function, which is to delete all the items in the database. So in here I'm just going to hit, try feed data. Help dot deletes feed like so on the Let's run that. And so it's going to do the same again at things to our database. I'm just doing this so it's more clear for you, and it's going to remove everything, something to stop it running. And then I'm just going to comment out this delete line, and now it should be just the two feet items that's gonna build it, run it. And then over here in our consul first it's printed out the ideas that were returned. Then it's Prince doubt the ideas, the name and the address is so that confirms that our database works and is connecting well . 23. Adding a feed via the 'Add Feed' view controller: Let's add a feed to our database via the in APP data entry. But before we do that, this feed items table view controller we modified last time, we're just going to remove the check database function, and we're going to remove it from here. So all that's left from last time was to create the data store as the sq flight data store . Okay, once we've done that, then we're actually going to change our add feed view controller. So inside here, if you recall, we set a name, label and address label and a safe button click function. So the very first thing we have to do is on safe button click. We have to grab the current text that is in the name label and the address label. And I just remind you of what that looks like. That's not working that way. Let's do it this way. It's going to compile everything and run around when I hit. Plus, we have both feet. Name, the feet, address and the save button. Okay, so in safe button, let's get the name and the address so we say, let name equals to name label dot text exclamation and we do the same for let address is equal to address label dog text exclamation. Okay, once we have those, we have to ensure that they're actually four characters or six characters or more. So we have to make sure someone's put some data in. So we do that by saying, if name docked characters dot count, So it counts. The number of characters, let's say, is less than four. Then what we're going to do is we're going to show and alert, and we haven't created this function yet, but we will, and we're going to give this alert a title of era, and we're going to say the alert is, Please enter a name. They put my at quotes in, Please enter a name longer than four characters. And of course, that's going to come up with an Eric because we don't yet have that function. But we will. And then once we've done that, we don't want to continue in here. So we just say return. Then let me just make some space here. We have to create a function that checks the address limp. So if address dot characters dot count is less than, let's say six. Because Web addresses are longer than names, we're going to show in a lot again. So I'm just going to copy this line and paste it right in here and then just change. Please enter and address longer than six characters. And after that, we want to return. Of course. Okay, let's just create that show alert function. So when you need to save person click function, let's type funk show a let and this is going to take a title, which is a string and a let which is also history open curly brackets. Then we have to create our alert controllers. We say, Let a let controller equals to you I a let controller Now some of you may have heard of a let dialogues, but those have been deprecate id and now you should use a let controller and then this asks for the following things a title, a message and a style. So our title will obviously be title. Our message will be the alert that we passed over and the style What is a few that we can have? We will just have dot a let okay that's created. Then we have to give this a button that lets the user dismiss it. So let's say let okay action equal to you. I A let action and this takes a title and a style, and the title will just be OK because everyone recognizes that style is going to be dot default, and we don't necessarily need a handler. So let's just remove that line from default there. Let's create our own action. You I alert action exclamation brackets and then say in Unless just send ourselves a message So we know what's happened. Let's just say print okay? Impressed. And that's close up these curly braces. And I think there's one more there. That is probably that's wrong. We need to close that bracket after default. There we go. That should be more correct them. And then we have to assign that. Okay, action to the alert controller. So loud, Controller Dr. Add action. And then we say, I want you to use the okay action I've just created. Okay, finally, we need to show it to the person. So we say self dot present view controller and we pass it The alert controller that we created we wanted animated. Yes, because animated is nice. And then on completion, we actually just want new because we don't want to run anything when it's complete. Okay, let's just five that up and check that it works is that should be able to find. And here we go. So if I click plus, when I enter a feed name that's too short and I click Save It gives me an era if the name is longer, but the feet of dress is too short. It'll tell me about the address, so that's great. It's stopped that running and minimize it. Okay, in our safe box and click, we need to create some further code that lets us actually save that data to our database. And that's really, really simple. And it's simple because we've created our help of functions in the previous lessons. So we have to do is say, do and then let's create. Our feed is equal to try feed data, help her docked inset, and then we're going to give it a new feed that requests images, names and strings. So zero our name in this case, his name because you've already pulled it out and the address it's address that is pretty much it to pop it into the database. Okay, let's do a check. Let's say print the feed that we just created and that will give us the i d. That gets returned from the database. And finally, we need to catch any errors with which there shouldn't be any. So we save that. Okay, It's just a slight error, probably because it once again the exclamation at the end. Okay, that pretty much covers inserting it into the database along with the data checks. So I'm just gonna hit play, and we're going to see if it returns some database I ds my click. Plus, I give it a focus name, a bogus address, something and I click save. And over here in my console gives me an idea of 12. If I save again, it saves it twice and gives me 13. So stop that, but this gives me a problem. What if my user keeps tapping the button because they think nothing's happened? Well, whenever designing mobile applications, we have to tell the user something has happened, and in this case, we can do that very subtly by changing the text of our name label. So once we've successfully safe this inside the do statement, let's say name label dot text is equal to nothing. And let's do the same for the address label. Dr. Text is equal to nothing. Let's play that. And now when we save, it's going to clear those boxes for us, which also has the knock on effect off, not allowing us to save it twice. Now, in my opinion, there's one further thing we could do to really let the user note. They've entered something correctly, and that's to close that view controller. So stop that running. Just minimize this and in here, let's put coat close view controller. Now this current view controller is pushed on top of our old one. So in order to remove it, we first have to grab the navigation controller that controls it. And then we have to do a method called pop View controller animated. And of course, we do want it animated, so we type true and that's it. To remove this view controller. So let's hit, play and check that works. It's let's hit, plus put around a name in and around them address. And now when I hit, save it pops it in the database and saves it for us. You could put another instruction in here that, like a floating up notification or something like that that tells your user it really has been saved. But if you're feed items are set to come up straight away or to reload whenever the feeds have changed, then your user will know automatically. 24. Explaining the table view and it's table source (UItableView and UITableSource): So what is a table view and what is a table view source? Well, I've explained them really simply here, using Lego and over on the left hand side, we have our table view sitting on a screen off our ramp inside our phone. Now the table view contains a bunch of cells. Which of these blue blocks going across here? A tape of your source. It's simply a class that hands these cells into the table view. The table view source also keeps count of all of the cells that are there and keeps track of each one. Now, where does the table view source get itself? Well, it can either create a brand new cell, pop some data in it and then send it to the table view. But creating a new cell is programmatically expensive. So we want to try and avoid that if we can. When we fast first start up our table view, we have to create new cells. But as we use our table view and we scroll it, these cells let me just move this start scrolling off of the screen, and then what the table view source does is identify those cells grab them and bring them back to be recycled. So a table few source will create a new cell unless it can provide a recycled cell. The final piece of the puzzle is the list of data and the table view source grabs the list of data and plants it onto each new cell, and it's then shown to you in the table view that pretty much sums up table view and the table view source. 25. How to create a UITableViewCell for a UITableView: let's sort out the table view that allows us to display our list off feeds. So this view controller here, which is called our feed list, seem under feed list. Open up table view and table cell. You'll notice there's a hierarchy here called Table View. Sorry, I should have mentioned you need to open up main dot storyboard toe access this screen. So when a table view we have table view cell and a content view. Now the cell is the item that populates this table view, and what we need to do is configure that cell and configure the table view to use a U. I. Table source. And the first thing we do is set the size of ourselves. So tap on the cell so that table view cell is highlighted. Then over in the attributes section, or rather, the size section. We have row height, which we can set as a custom value. Normally, it's 44 I believe, but let's set it to something a little bit larger and user friendly, like 80. Okay, and that gives you a preview. Now we need a class that defines this, so so come over to your project right click new file. And then let's select source Cocoa Touch class and click Next. And now we have to give this class name so we will call this feeds, and this is going to be a subclass off a U I. Table view. Sell and you'll notice it depends the name for us. We want the language is swift. That's click next, and it will create it for us and then open it. Now this class is going to define that sell we've just been looking at, and it has some methods already implemented, like awake from Neb and set selected. Now go back to your main storyboard. Select your feet, bliss scene and select your table view. Then open it up and select your table view. Sell because we need to assign that class to it. Open up the attributes inspector for the table view cell. Let's find the identify air, and then let's call this feeds table view sale, and that is simply a string that identifies what kind of cell this is. But we'll get more into that a little later on in selection, let's have none. In fact, let's not have none. Let's have default for now in the size inspector check Our row height is still 80 that is, It's good. Then open up the identity inspector and we're going to choose the class we just made called Feeds Table, View Cell and save all of that. Now let's add some things to ourselves. Let's make it obvious to see So let's hit editor canvas show bounds rectangles And there we get some nice blue rectangles wrapped around them. Now, Now let's come over to our objects. And as we're displaying a list of feeds, we only need one element, really. And that is a text field or a label. I think. Let's try a label for appear and let's drag it to the corner there. And then if you double click it, you can change the text. So this is a really long label for titles off our says feet, okay, and by increasing the size of the text, we can see that is now shot off screen, so we need to change some properties of it. So come over to the attributes, inspector, and let's have a look at what we have here. So line breaks. Truncate tail. Yes, we will have that and let's have a view mode left that is fine. We can change the Alfa and the background on this in various other things. So up here in alignment, let's have it left aligned. And then let's drag it across a puppet in the corner that should hold it Now. Then we need a text field, and this text field is going to hold probably the address. So in here, let's just type address. Then let's hit this title label and drag until it fixes itself onto the side of the screen so it occupies the entirety of the whip and for the address. We, of course, could do the same like that. We can change various things inside our inspectors. So we have our view rectangles, etcetera. We're not going to change anything there for now. What we are going to change is this front size here. So let's increase the title front because this will hold the name of our RSS feed and for the address one, I'm just going to decrease it, a touch to balance out the feel off the cell, and then, if you recall from our lesson on how to make absolute good What we need is sort of a balance in the picture like that. That should just about do it. And then to see our balance in action, we can switch off our bounds rectangles like that. Now, our text field, I think we're going to change this actually to a label. So just delete it and drop another labeling just then and I'm going to put this over to the side, drag the end over here and just call it address. And then once I've done that, I'm going to do the balancing again. So I'm gonna drop my font size somewhat click out of it. And I'm just going to move things around just to give it that balanced feel that the photography rules go by so that to me now looks a bit balanced. If you can ignore the prototype cells up there, it looks just right. It looks aligned. Now we have to connect this cell to its base class and we need some outlets toe hold these labels for us. So select one of the labels, come up to the top and select assistant editor. And if we need a little space, we can start removing things from the sides here that's a little better on the top, right? Let's select feeds, table view cell and then underneath the class line. We're going to put Mark Properties just to mark where we're putting these outlets, then hold down control and click and drag into your class. Then, of course, you have to give it a name, so let's call it feed, name and we want. This is an outlet on US label. So click connect. Then we're going to do the same for the address section. So control click and drag across and we will call this feed address and click Connect. Now our cell is more or less set up. There's just a little bit to do, but we'll cover that later on. 26. Populating the feeds table with our cells: right. The next thing we need to do is to populate our feeds table with the cells that we just created. And before we do anything, we need to have some access functions inside our data models dot swift. So inside the class of feed, we're just going to create a new function. And this will be entitled Funk Get name and this will return a string and which is going to return the name? Then? Of course, we need something for the address and the i. D. I just have a slight error here. Let's put exclamation so it's quickly type these out funk get I D and this is going to provide. And in 64 and we're going to return I D. And finally funk get address and this gives back Bay String open curly braces and return the address. Now we have a way to access our data. Inside this class, we can get on with creating our table. So the controller that controls our table is called feeds table view controller. Let's click that, and first, what we need is a class level variable that holds our feeds. So underneath the class declaration, let's type of our feeds is equal to square bracket feed array. Okay, now we need a function. So let's load this under view. Did load. And this function is going to populate those feeds that feeds variable we just created. So that's type of funk get feeds, open brackets, curly braces then we won't do. And we're going to say feeds is equal to try feed Data helper don't find all. So if you recall when we created this this retrieved all of the feeds from our database table and then we're just going to check that it worked. So we say four feed in feeds open curly braces. We're just going to print the feed, Don't get name like so that we just need to end our do statement with a catch catch underscore Open braces. Unless just tell ourselves that we had an era. It will say feed, database access, era like that and safe. And we have a note. The air is gone. We're fine. So let's just run that and ensure that everything works. Okay, Now, when I hit this icon, we goto our feed list and we forgot one thing. Just stop that running. We haven't actually called this function called Get Feeds. So let's pop it inside. The view did load, Let's say get feeds, save it and then let's run that. Okay? And now when I open it and I come back to Swift two X Code, Rather and I opened up my debug channel here, we can see Ah, whole bunch of names of all the rubbish that I've put in whilst testing that my database access works. So now we know we have a list of feeds available to use once this has run, so that's stopped that running. Minimize the debug window now because this class implements a you a table view controller. It's a mix between a view controller and a table view, so everything I'm about to do you can also apply to the regular you a table view. It doesn't have to be a controller. Now. Every table view, whether it's part of a controller or not, needs toe have three basic functions to survive and underneath get feeds. Let's have a look at what has been implemented for us. The 1st 1 is number of sections in table view, and this is the 1st 1 so we have to tell our table how many sections we want. If we have a lot of data, we could group it together into sections. And you may have seen this on I us, for example, in the settings application on the iPhone. But we don't we just have a simple list. So we just want to return one section and save that. Then if we scroll down, we have another function here. That's number of rows in section. So this is the 2nd 1 that every table view needs. You have to tell it how many rows are in a section? So for us, because we only have one section, we just want to say it is simply the number of feats. So feed's dot count. Let's remove these warning comments because they've now completed those and move on to the third thing that we need. And that is this method cell for row at index path. This method is going to get either a new cell or a used cell, and it's going to pop it going to populated with data and show it inside our list. So first, let's remove these comments that I that X code has put in for us and let's get on with configuring this function because this is the main part where we were actually put our data in and organize everything you know. The first thing we need to do is create variable in here called Let three years identify it equal to, and this is just going to be a string. Now you re use identify a is away that I ost, discovers or knows which cells from which lists to reuse inside your list. And if I just go to my main dot storyboard and I click on this cell, if I can get the background there it is up here in the properties we have feeds table view cell that is the identify. So let's come back to our controller and let's say feeds table view. So then, on the next line, where it says, let's sell equal to etcetera, etcetera, we are simply going. Teoh removed the quotes and we're going to make it equal to the reuse identify that we have now set. Then we have to downcast this so we say as exclamation feeds tape of your cell to make sure we have the right kind Then I put a comment here that says We're now going to fetch data. So let's say let feed equal to our array of feeds and then we need an index. So which one are we going to pull out? So open your square brackets and the way you find that is by typing index path dot right and close your square brackets. So now we have a feed that corresponds to the road that is the cell that is being requested . Then down here, what we're going to do is put the name and the address from that feed into that cell. So let's type cell dot feed name docked text is equal to the feed dot Get name. Then we want to set sell dot feed, address docked, text equals to feed dot Get address. Okay. And that's it. We're finished. All this method then needs to do is to return a cell. So let's save that. Let's run it. And now when we open up that section, we should have a list off our RSS feeds Sam going to open it up. And there it is. And nothing happens when I click it. Okay. At the moment it doesn't look very pretty, and it looks like it hasn't implemented the size of cell that we actually requested. Let's come back to Ex Code. Stop this. Let's find out why that is the case. Let's click on main dot storyboard, and if we click our cell, we have a row height of 80 which is fine. However, if we click the table view and we look over in our properties are row height is still 44. So let's match those. Let's make this 80 and now we should have a row. That is the same height as the cell that we are providing. And there we go. That's much better. Now we can see all of the junk that we put in during out testing of the database function, and if I click it, nothing happens now. Ideally, we don't want anything necessarily toe happen when we click. But what we would like to have is a slide to delete function, you know, on the iPhone. When you slide left, a little delete button comes up on the right. So let's pop that in, because that's very easy to do, and we'll cover that in the next lesson. 27. Deleting an item from a table view row. AKA - slide to Delete in a table view: So let's edit our feeds table view controller. What we would like to do is implement their swipe to delete functionality on I us. So if we scroll down, we can see we have some more methods that have been commented out, and we're looking at this one of right funk table view can edits row at index path. So let's delete those comments. And now this will allow every row to be deleted ble. If we wanted only some rose to be deleted ble, we could put some functionality in here to do that, A return of false but by default will return true. So once we can delete it, we need something to happen when we press the delete button. And below this function, we have commit editing style, and this is the function that we want. So let's remove these comments and have a look at what we've got. So if we have, if editing style equals delete, then we're gonna delete the road. Or if editing style equals insert, it will insert it. We just want delete. So in here we need some functionality to first remove the feet from our list of feeds. We currently have, then we want to remove that feed from our database. And finally, we're going to remove the feed from the current list of cells that we have now that 3rd 1 removing from the list of cells is already done by this method by default. So in table view, Dr Lee Rosen index paths. It's going to remove that road when you press delete. So well, we have to do is remove the entry from the database and remove the entry from our list of data. Let's go ahead and do that now before doing this. I think it's quite important the order that we do things because we don't want things to interfere with each other. So I think first of all, what we will do is we're going to get the feed. Then we're going to delete it from the database, and then we're going to delete it from our list. So let's say let feed equal to feeds, and then we need our index path dot ro, and that's something you're going to use a lot index path dot ro. Then we need to remove that feed from our database. So type do open curly braces try feed data helper dot delete And he asked us for an item which will be feed. And then we have to catch the era if there is one. And I've got a warning. No, we're OK for a warning. Okay, that should remove it from our database. Then what we need to do is remove it from our list of feeds. So Feed's dot removed and we have a couple of options, but we won't remove at Index, and we use our friend again. Index path dot rope. Okay, let's say that compile and run it. And now what should happen is we have implemented the swipe to delete functionality. And whilst that's building just a word to say, iPhone users expect this, so you should use it wherever you can to delete things from a rope. So it's just loading up in my iPhone six and let's open up this. And now if I swipe, I'm able to delete things. Some Grange delete feed one right at the top, and when I do, it disappears. Now I'm going to exit, and when I go back in, we have an era. Now it's come back to Ex Code and see if an era has shown up. No, we have no era coming back to the simulator. We have no error here, so we have to figure out just exactly what is going on. Let's do that by stopping and restarting to see if something has gone wrong with our database. Because if it has, then it won't work. I think something has. So let's do a little investigation. So at this point, we come really to the first bug. And the way to sort out bugs is to start again from scratch. And I don't mean recode Everything. I mean, go over to your simulator, press the home key, click and hold the app and delete it to remove all the data. Okay. And press stop if you're still running it well, given error, but you can breast stop. Okay, so we have some sort of error when we delete something, and I'm willing to bet it's something to do without database. So, in our feed Data Helper inside our delete function, let's have some sort of print line. So we know something has gone wrong. So in here, let's have Queary delete failed, and we will give us an index off one and then up here, we're going to have connection failed and we don't need an index for that. And then inside our catch, let's have queried Elite failed to. So now if we'll get one of these messages, we know that something has gone wrong. So we're just going to run our app. We're going to add a couple of feeds and they were going to delete them. So let's hit ad, put some rubbish in They go and I'm gonna hit out again. Put some more rubbishing and click save, and now I have a list of all of my feeds that I can scroll. I'm going to delete the 1st 1 delete. Let's come back to Ex Code and here we g O. We now have something in our console, and it says both of thes have thrown an error. Query. Delete failed one and queried elite failed to. So let's deal with this 1st 1 first, and this says that our query Doctor Leet has failed to run. So let's look at exactly what it's trying to do. First, it's saying let the query equal table dot filter and the filter is applying some sort of term to see which thing to delete. And it's trying to find the I D and have made a silly era, and this is a warning to all of you. Budding entrepreneurs and app developers don't just copy code from your previous apse, which is what I've pretty much done here. I should have read it more carefully because let query equals table dot filter. I need to have the i D off the filter equal to the I d off the item that I pass in, which is up here. So let's do that. Say item dot get i d. Then let's switch back to our simulator, delete the app and let's start again. And now we should be able to delete things and delete them from the database successfully. So first, let's out a few because there'll be none existing. As we deleted stuff. Let's add another one like so now when I click my feet items or feet list, I have some items and I'm going to swipe delete it, and when I come out and go back in, I only now have one item remaining. Now, if I click this item, nothing happens all that happens is this gray selector comes up. We either want to remove that selector or have it disappeared when we click it. So let's come back to here and press stop open up feeds table view controller. And then let's look at work methods we have in here. Set, let's scroll down. And there is nothing obvious for when we select something. So let's have a look at our main story board and have a look at our table feeds tape of you sell. And if we look it through our attributes down here, we have a selection. Default means that gray thing that flashes up. We want none because there's nothing the user can do when they click it. What we can actually do is we can add one more field that says Swipe to delete. Let's drop a label in two here, and let's drop the font size way, way down. Move it over to the right and type swipe to delete. This just lets our user no, that they can actually remove this. Let's have the color as more of a dark gray, or if you want to be a little bit adventurous, we can have it as our purple apple color. I kind of like that. It's from that, and it should look a little better and not have that gray box that appears when we click it . So no great box. But we still have the delete, however, and you'll come across this. A lot are swept. Delete has disappeared. So let's grab some anchors and actually move it around and make sure that it sticks inside . I was so in fact, let's move it up. And whilst I play around with that, I would like you as a little bit of homework toe actually play around with the layout of this cell, and I want you to pay particular attention to the photography rule and the one in particular that says you have to draw your users I to the things that are really important . So in this case, my swiped delete is not very important because we'd hardly ever use it. The address isn't that important, however. The name is important for our user to see at a very quick glance exactly what they're subscribed to. That pretty much concludes how to populate our list view 28. Disabling app transport security (and introduction to Info.plist): all right. Before we move on and retrieve our RSS items from the Internet, we first need to set something that was introduced in IOS nine and that is at transport security now up Transport security was devised as a way to prevent unsecure connections from happening in your app. However, with an RSS reader, we're going to occasionally have insecure connections. It's just the nature of the business. So we have to disable this method off apples for authenticating connections. And the way we do that is by opening up our info dot p list, right click, click add row and then let's delete that. And over here, where it says type select dictionary and then we are going to call this an s app, transport security and click the plus, and we won't allow arbitrary loads as Boolean. And we want to change this to yes, and this just allows us to load anything within the hour. If you have something that's not RSS reader, it's worth actually keeping the transport security set because in future versions of I us, it might actually require it. So just somewhat of a future proofing okay, and let's discuss the elephant in the room, and that's this info dot p list. If you recall in the data section, I said, you can use P lists for your data within your app. If you so wish generally for default settings, you would use it. But in our info dot p list, it tells Apple and the APP Store and indeed, your IOS devices what sort of things we support. So just a example is this supported interface orientations. And if I click this down, it allows portrait both bottom and upside down and landscape both ways. So in here are a bunch of things you can change, but I won't go into it now. 29. Getting our RSS Feed Items: just before we begin getting our RSS items from the Internet, we first have to modify our data models dot swift, and we have to specifically modify the feed item because we need a way to get our data out of it. So let's create some access methods. That's coolies, funk get tryingto. And of course, this will be a string and we're simply going to return tryingto and then let's do the same for the description and for the link. So funk description, return description and finally have a link link string return. Okay, that's all set up to access these items. I would just have a slight problem here. Go to put in a string, have a go. Okay, then we're going to look at the main screen and actually grabbing RSS feeds. So open up your feeds, your feed items, table view controller and inside here. Let's put a few class level variables. I like to put them some. We need to talk. It's the first thing we need is a list toe. Hold our feet, items that we've that we've retrieved. So that's tight. Far feed items is equal to an array or feed. I took have been re initialized that right? Then we need to keep track off the current feed that we're on. So you say far current feed and this is simply going to be a string. Then we come to the main thing that we're going to use inside here. And that is the possible to this type of our and this is equal to and end s XML positive. Thanks. Now I forgot to mention up here inside class, I'll just remove that I actually had and in its external passive delegate. So after you, I table do you control that rest coming and pop in Ennis XML pass a delicate that allows us to implement the methods off the Ennis XML pasa. Okay, finally, we need a bunch of variables to hold our various elements off the XML. And I keep mentioning XML because RSS is actually XML. And if you don't know what excellent looks like, have a look at this. This is XML. So XML has a tag or an element i d. And then it has some text inside of that. That's all it is. And it's the same with RSS. If you recall from an early lesson. We had a look at this. So we need some variables. Toe, hold these tags. And this data, it's the 1st 1 we're going to have is invariable called entry title. This, of course, will be a strength. I need a car entry link. This too will be string. And then we need a far entry description, which is also a string. Okay, so that'll cover the title link and description off our feet. Ison. Then we need something to tell us Which element we're currently looking at This will refer to the tag. So that is a far current past element. And I'll just show you a different way to initialize a string like that because string And then finally, we need to know from our XML pasa that we're actually inside an item that we want to pull from the feed. So we need a boolean variable. So we will say you are inside and item and we will set this first value as close. Okay, there's all the variables that we're going to need now, inside our view did load function. We're going to put in a little bit of code that allows us to get these feats. So that's type dude, from the first thing we have to do is get an array of our feeds. And if you recall, we store those in our database so that feeds equal to try feed data help I don't find. And this just gets all of our feeds. Then we're going to take each feed so four feet in feeds and we're going to do something with it. It's the first thing they have to do is get the address current. The feed is equal to feed. Don't get address. Okay, then we need to get a URL and NSC or L from that feed address. So we tried that you are l type in issue r l equal to in this u R l An insight here you want to string that will be our feeds. Don't get address. And that just gets your l in a format that I asked once ended with an exclamation. Then we have to set our pasa pass it equals and it's XML sit and then ask for contents off You are, and so we give it your all we just created. And then we have to get the pasa some delegates. So these are the methods that are going to be implemented because we've inherited up here from Ennis XML Pasta delicate. So that's really easy for state pasa doctor. Down against is equal to so and finally we have to fire it off. So it's a passing dot Okay, once we've done that, we should then have a list off our feet. And to check that we're just gonna printouts, um, Fatties. So let's say before each feed item inside a list school feed items that we created. Let's just print out some default values. Let's say print feed item dogs against protected, and then let's we'll just use about that. That's called me that line. Let's do the same for the description. Yes, description. And then let's print a space said to give it some room, and that's fine for that. That will check through our entire feet item list. Then we have to end. Of course, this do loop with catch going to school parentheses. Let's just tell ourselves because an error era pressing well, getting feeds rod. Okay, now we have everything we need to pass our items. We now have to write these delegates from pasa Doc Delegate. So come out of there, Hugh did load function and create some space underneath it. And let's write those. So the 1st 1 we need anything from Cossette. And now we have a whole bunch of options. And the first thing that we gotta pick out is the did start element. Sit, double click that and it will open it out for you now they did start element takes place whenever our pasa finds one of these So a note to from heading. So this function will fire when it finds one of those. So the first thing you have to do is check if our element name is equal to and fight him embraces. And if it is equal to an item that we type inside and writing, is it true? And this tells us everywhere else. But we're currently passing and vitamin not any fatty of statement. Let's have another one. Let's see if we are currently inside an item embraces. Let's have a switch case, so switch element name compresses. And then we're going to say, if you have a case where the element name is title, then let's set our entry title equal to and you string And let's say the current past element is equal team title. Okay, then we need to have another case. So the state case, if you have an element called description correctly, then we have to set our entry description. Made a slight error that here we go. It's a Our entry description is equal to based on Ustream and again we set the current past element equal to description. Okay, then we need just shoot these over so you can see it easily. Then we need a final case where we have a link case, I think. Do we say entry link Z Z and you String of the current past element is of course, to failing. And then if none of these apply, we need a default case. So default simply break out of this switch case. Okay, that is all we need inside this function. So this is just setting up. The rest of the functions were about to write to let them know which element we're currently in. So down here, that's right. Another fungal passive function type said, Pass it. And then we want the found characters one. Let's click that and open it. Now this fires whenever our past defines the characters inside these tags. So whenever it comes across these, so we need a way to store these, and first we have to check were inside an item, so get inside an item is true. Then we need a switch statement and we're going to look at the current past element embraces. Our first case is if that element is equal to a title, and if it is, let's say our entry title is equal to entry title, plus of the string that is passed in. Now why do we do this? Why do we have to add that? Why doesn't just grab the whole string? Well, it doesn't because sometimes it will stop from this white space and go around again. Or it might stop another characters like this apostrophe. So that's where we have to add them one by one together. It's a strange peculiarity when I don't know why they particularly done it like that, but that's the way it is. So every time we go around, we have to make sure that we still we have everything from that element. So let's do a case for our description and say entry description is equal to entry description. Thus string, that's the wrong one across the street. And then we need a case for me that should be entry link, secrecy, entry, blink less string. And of course, we need our defaults. She's break. Okay, that's all we really need to that section. Put that character in that and we need one final passive function, and that is Funk Cossette. And this one is when we get to the end off the element, So did end element, and this fires whenever the end of an element where they Ford Slash has encountered. So at this point, we know we've passed through certain things, and we want to reset all of our variables and states to the standard. So if we're inside and item, that's a switch for the element name. Let's have a case where the element name is title, and we will say the current past element is equal to nothing at a case where it is a description and again said current past settlements equal to nothing. And in the case where it is, of course, link getting my hair. Karan's here and of course set current past element equal to surprise. Surprise. Nothing. And we need a default break. Then we need a further check. You have to say, Yeah, element name is equal to write him. Then inside here, we know that we've gathered the title description and link from the item. So we're now going to create a new feed item. Let's feed fighting equal to be item. And we're going to say the title of description. Really? Well, we now have those. So that is our entry. Try toe our entry description. And, of course, our entry link. Okay, we now have our feet item, and we need it to abd it. We need to add it to the list that we created way back earlier. Sophie items don't. So that's capitalized. Items dot append and then we give it the element we just created. So feed. And then finally, because we've just come out for an item we have to say inside an item is false. Okay, that is all we need for that. So I'm just going to run that, and that should compile Well, and here we are in our simulator, and when it opens up, we won't see anything. Perhaps if we come over to here, we'll see for an Apple RSS feed in. And it's just giving us the title and description, the title and the description. And if you recall that was done at the top here, it sent. Once we have our list of feed items, let's print all of these things out. So that concludes getting all of our RSS feed items. 30. Creating the cell for our RSS Feed Items table view: Let's create the cell for our RSS feed items. If you recall earlier, we created a cell for the feeds table view, and here it is. So it's create another one under beautiful RSS feeder, right click New file, Cocoa Touch class next, and table view cell is already selected. Let's call this feed I to tape of you sell and we want the language of swift Click next and create, and they we have when you So then let's open up our main dot storyboard, zoom out a little and select the table view of our feed items over in the inspector on the left click table view down and table you sell, selected over on the right hand side underneath our inspectors. Let's give it a custom class, and this is under the identity Inspector. Click the arrow down and there we have our feet item table view self and then press return . Then let's give this item. Ah, height. So a row height off. Let's give us say, probably 100. Make it nice and large for our users to see everything really well. Then click our table view and under our size, Inspector has changed our row height there to 100 as well. Now they should match up. The next thing we have to do this is like the table. Do you sell and stop dragging in some items we would like to see within that cell. The fresh one we want to see is probably a label. So it's drink that it. And I'm just gonna put this on the center line and at the side. And then I think to drag these to the top into the bottom and then in the attributes, Inspector, I'm going to make the front much larger. We're going to double click that item and then just put one lettering. That safety. Okay, What I want to do here is center that p. So any attributes, Inspector, about my text alignment to center, and then I'm just going to expand the size of it a little to make it kind of square, and I'm going to keep increasing signs of it. And the reason we're doing this is because this is going to give us a visual index off the stories that are put inside our list. So this letter, he's going to be the first letter off the title off the feed item that we have. It's just a nice way off, making the at look really nice and without noting any data, heavy images or just viewing heavy images. So let's keep increasing that. That's probably about right. Then, of course, we need another label. I'm going to drop they seen around the top. Let me just grab that again up there somewhere and let's shift it across, and then what? I'm going to do something to control. Click it and drag it to the big P, and then I'm going to give it some space in here. So let's try leading that's room. I'm just going to do that. So either when we drink this, we can control click things and drag them all. We can come down here to the bottom right corner, if you recall, and we can add constraints manually. Sometimes control clicking is easier. Sometimes clicking these is easier. So let's get this large letter lined up inside off you. Let's control click and drag over to content few and let's have a leading space to contain a margin. Okay, let's leave that. That's Seaver, and then let's have a control click. So the content view again. Let's have a top space to contain a margin. And again, let's hope that and Zira in select our content view down in the bottom. Let's update frames. Okay, then let's get this p a size. So in the bottom corner we can manually give it a size. Let's give the width of 80 and a height to match ourselves at the constraint and again slaps the content view and we can update the frames. If we have the content view still selected, they won't get okay. Now that's kind of sitting in there. Now. This label we need to move relative to this p so control. Click it, drag it to the P and let's have perhaps a horizontal spacing, and we can specify that. So let's give it some breathing room off about 10. See that looks like Okay, let's control Click Label again to content you, and we want a top space to the container margin. Let's drop it down a little bit. In other words, so labeled on top. And let's give this zero. Yeah, that looks about right. Click labor one and let's increase its size or the funk size rather, and now we need some width. So let's control click it, drag it to the content view, and we want training space and this value we need to sense at about 10 and that allows it to fill up the entire cell. So now when you click it, you can see the width. Finally, what we need is a text field, which I'm going to drag just to anywhere on the screen. I'm just going to fill it with some random text, and then I will control click it to the label, give it some vertical spacing. Set this value at zero for now, control click. It's to the P. Give it some horizontal spacing. And which one do we have here? It's that one. Let's have a constant zero like the label above it. Then it's update frame. Okay, things are looking a little bit better. This text field. Let's change the border style over in attributes to nothing, because we don't want to see a border around it. Okay, this label, let's actually change this 20 Here we give now everything looks lined up to me. Let's click the text field and over on the attributes, Inspector. Let's look through various values like size, and I'm not going to show you how to do it. But what I would like you to do is allow it to have multiple lines. So, looking through these, you might find something that you can change. Okay. The text field, way to control. Click it to the content view, Have a training space. And that trading space. I was going to be 10. So it fills up the content, Then I'm going to give it a trailing space to the bottom off the content view. And I need to get that in constant off 10 as well. Now, I can update the friends, okay? And that text box should fill up of its own accord whenever we populated. So I'm gonna click my p make ever make sure everything is okay. Yeah. Okay, so let's say that and we've created I was So the next thing we have to do is to open up what we call the assistant editor, and then I'm just going to remove some of these windows to make it more clear for us. Then what we have to do is drag these items over into how, uh, no feeds item table to you controller, but rather the tape of yourself that's not showing. Right now. We'll try manual RCIs feta All right, since FINA anyone feed item tape of yourself, we get Let's control, click the P and let's drag it over to our table view sale. Let's give it a name and we'll call this large a letter, connect and then make some space under there. Let's do the same with the title label, said Control. Click what it in there and we will call this title label. And then we want the description, tanks, description, text the field and connect it. Okay, now we have everything connected over. We can restore our view toe as it was before and close this section. 31. Populating the RSS Feed Items list view: Let's populate the list, view our RSS feed items. So if you recall inside our feet items table view controller, we have a list of feed items, and that was gotten from when we passed all of our feet. So because this is a table view controller, it includes by default a table view. And when this file was created, it's automatically put in the number of sections and all the various methods that we might need for a table. The first thing we have to change is the number of sections in table view. We only have one section, Let's return one and remove the warning. Then it asks for the number of rows in section and let's return our feet. Items don't count. This just gives us the number of rows that we need as the number of feed items we have to display. Then what we have to do is get the cell for road at index path. So let's remove these comments. Yeah, and let's configure this cell with our data and with the various elements inside it. So let's look at a cell we created previously. Let's look at the feeds, table view, controller and If we scroll down, we can see ourselves for road index path, and the first thing we have to do is identify the re use. Identify. So let's do that in here. Let's say let re use, then fire equal t feed item table you. So then, let's set that here in deaky Reasonable self So read, use, identify it and there's something we haven't done, and we haven't actually specified this string inside our storyboard. So let's copy it. Go to main dot storyboard and let's click our so our feet on table you so and let's try and recall where we do it. It's over here In the attributes inspector, It's paste our feet item, table, view cell and press return safe that let's come back to our feed items table view controller. So now we have that. Let's have a look at our feets table view controller and see what else we have to do. Well, this says we actually have to cast this as the particular cell. Let's do that back to our food items. One type as exclamation feed rights and tape of yourself. All right, now we have to sell. Let's check our old version. We have to fetch the data and then put some data into the cell. Okay, that should be no problem. That's type. Let's feed. Thank you, Kulti feed items and then we need on index location, which is index path. Dot wrote. And then we have to feed some data in to ourselves. So let's say so dot and we have to recall the variable names it used. I believe we had a large letter. Don't text is equal to now. You have to be careful in Swift because strings are handled differently than in other languages. And what we want to do is grant the first letter off our title. So the first thing you have to do is say, feed on him, don't get title, and then we need to give it an index for which letter to grab from this. And the way we specify that is by feed item. Don't get title don't stopped Index and then we type doctor triangular bracket feed item. Don't get title again. Don't start index dot successor. Now it's a long way around just to get a string, but I'm afraid that's how you have to do it in straight. There are other ways to do it, and I'll leave you to search on places like stock Exchange to find out how. Then what we need to do is sent to the actual title, so sell dot title label Dark text is equal to feed. Item. Don't get title. That's simple enough. Then sell dot description text field dot text is equal to feed item. Don't get description and say that and let's run it. And if everything's gone well, we should see our list. Viruses feed items appear on the screen and there we go. We have a whole bunch of things now they will begin with a which is a bit strange, but it is apple. So if they've started everything of apple, that's the way it is. We could modify this. I think what I'd like to do and what I'm going to set you for a little bit of homework is to drop this a the large letter down a bit, so it's directly in the center. I want this title to be a little bit smaller in size of text, and I want the description to be a little bit smaller and to have multiple lines. And here's my modified version. I'll just give you a clue as to what to do for the multiple lines, and that's to replace the text field with a you wine label and then to set the number of lines of the label to zero. Then, of course, you have to connect the label via an outlet into your feet item table for yourself, and then you'll probably need to change everything inside your get cell method. Okay, that completes how to list our RSS feed items on the front page. 32. Handling a click on the Feed Items list: okay. We need a way to open up a Web page that allows us to view our feet item when we click it on the front of the U controller. So inside our feet items table view controller, let's scroll down a little. And underneath self a road index path that's type, override, funk, table view. And now we have a bunch of options and the one we want when we click on a road is called Did Select Row at Index Path. So we have to here. I'm not quite sure why, and they seem to be exactly the same. There's no change, so we'll just have the 1st 1 And there's a warning for budding program. Is there even someone with the likes of apples? Resource is can get things wrong. They can put something in a list twice. So if you have bugs, don't fret over them too much. Just simply work on them because even apple things get bugs. Okay, in here, let me just put a comment. We're going to have a code to fire you If you controller for web you off RSS item. Now the first thing we need to is we need to know which controller we're going to fire up. And if you recall from previous lessons, we made a Web view controller. So let's go to maine dot storyboard. And here I've got my web view controller open. And if I click on the top tab when I come over to the identity inspector, it asks for a storyboard i d. And this is how we identify few controllers. So let's call this feed fightem detail you, controller, this is going to be a unique I d of this few controller so we can find it. Then inside our feet items table view controller inside that did select row at index problem. We then need to refer to our storyboard. So I say, Let story boat equal to you. I storyboard and then we need a name for a story boat and in our case, it's really simple. He's just may and our bundle is going to be new. Then we need to find a view controller inside that storyboard. So we say black BC equal to storyboard don't. Instead, she ate you controller with identify it. So this just takes a view controller. It makes a new instance of it and it asked us for the identify. So if you recall this was feed item detail, you controller, Now get crashes in your raps. This is a good place to start. Looking is because people get this wrong fairly often. And then we have to say what type it is. So we say as exclamation Web view controller. Because remember in a previous lesson, we made a class up here called Web View controller, and we attached it to that few controller in our storyboard. Now that we have a few controller, we need to show it. So let's do yourself start show you controller. It asks us which one? We see that one we just made and asks us for a sender which will be new, right? Let's press play and that should build. And when we tap on the road, we should get the few controller being opened. So if I hit a road, it opens. Some were scroll effect going on, but we'll get into what that is in a bit. But if we press back, it goes back for us. Okay, that's took that running. So in the moment we've passed out, we've created a new detail view controller, but we haven't actually passed over a u r l toe open. So to do that, let's open Web view Controller an inside here, we need a variable that we can set, preferably a feed item variable. So tight, far feet. Item equals feet, aisam. And let's just put some empty variables to initialize it. Then what we need is we need a function that allows us to set that feed Item three local, this set feed item. And of course, this will be eight item off type feed item open braces itself. Don't e. Dyson is equal to the feet item that we have passed in. Okay, Now let's come back to our feet items, table view, controller and let's find our didn't select road index path. And then underneath fee c, you will say BC dot set feed item, and that allows us to give it a feat item. And we're going to pull that from our list of feed items. So I think items as capital feed items and then we need an index, which, as usual, is index path, dark road and and everything. Okay, so what happens here is if you control against found it gets initialized, and then a feed item Miss sent. And then we show the view controller come back to the view controller. And now that we have a feed item, we have both the type. We have all three off the title, the link and the description. So we could set the title of this view controller as the title off the story. But I don't think we really have to. I think it will clutter things somewhat. So the only thing we're going to do is we're going to use the link to lay out to load up in the web, you that we've declared an outlet for here and we will do that inside. You did load so in there, let's make a little space and type you. I love you Don't load Request. It will ask you for an instance of a Web view which we have from our Bartlett. That is our web. You open brackets and then we pass it in N S u R L request and inside there, open a couple of brackets and let's have you r l you are out of type N s u R L and then we have to pass an issue. R l A string and miss string will be feed item that we've just passed over dot Get link. Now there's a lot of brackets here, so we have to be careful that we've got the correct amount. Okay? And after the second bracket, after get link, we need to have an exclamation. Okay, that should be okay. It's still showing an error. So let's click the error. I cannot call value off non function type girl. That's strange. There we go. If you double click it, it actually puts it in. Okay, now what That should do. If we run it, it should open the u. R l off the feed item that we have just passed over. So let's see if it works. I'm gonna open up this one, and there we go. We have the apple website that's being pulled up. Now the first thing you'll notice is that it's kind of out of alignment, and that's because we had some sort of pad ings and margins set inside our storyboard. So let's fix that. The other thing we're going to fix is we're going to resize the web page to fit the current view, so it looks a little neater. Let's come back to Ex Code. Stop that open our main story board and let's have a look at our Web view here, and this has a bunch of constraints. What I'm going to do is just remove the constraints one by one, because if something's going wrong, it's always best to start your constraints again. I'm gonna grab my Web view. We're going to attach it to the sides here. Actually, we're not going to do it that way. It's doing constraints way. So back down on the Web, you let's control, click and drag over 12 you and say leading space to contain a margin. Then let's select it and shoes survive you. At this point in time, it is zero Now I believe it's giving a margin of 20 somewhere, so let's click the Web view. Let's scroll through some properties, see exactly what it's up to here. So there's nothing kind of obvious. And to be honest, there is nothing obvious, and that's because interface buildings doing something in the background that we never really asked it to. But it's done it since about X Code four, I believe, and that is that it's putting a superfluous 20 decimal points off padding around this, and there's nowhere we can actually change that. So what we're going to do is we're going to change these constraints to be a minus 20. I'm going to add some four vertical spacing. Let's give this a minus 20 and let's give the side trailing space a minus 20. Now, if you bring size update frames, everything should more or less fit. We just need one more. And that is, Wait, let's just get the left one sorted, it says, minus 20. Let's have this actually on Plus 20 and update dreams. Okay, good, then what we need to do is click our Web you control click drag. It's the view, and we need a space to the bottom. So vertical spacing toe bottom and we need to change that to, let's say, 20. Or Syria now it should feel our screen. The other thing we have to do is click above you. Let's click the attributes and under scaling, let's have scaled pages to fit. Let's play that and see what these pages look like. Now it's an hour click something. It's a load of off you and we can scroll through everything okay? And it's giving us the mobile version off the website. But at the top of page, if I take another one, we still have this strange, ugly gray bar. So I'm going to assign that to you as a little bit of homework. Just check exactly what the Web view is trying to do because it allows our items to scroll over it. But it's still there nonetheless, and we'd like to fill up the whole thing. So your homework is to try and remove that grave, you at the top. And if it's one of the bottom, try and move that, too. And stop that running. But basically, that is how we open up at Earl inside a Web view, which is insight in you view, Controller 33. Why we need to debug iOS apps: right. Let's run around inside our simulator and we get a screen that pops up that shows us what we need. What happens if I turn my WiFi off and then I restart this simulator? I get a blank screen, and this is a problem we need to tell our user. They have no Internet for us to connect to the feet items, because if they see this, they'll blame you as the developer and not their own device. So this is part of debugging, and things like this are the primary reason that we do debugging and testing. Now those two words debugging and testing you will perform 50% off the time it takes you to develop your app. So half the time he spent D parking, and that is to give your user a good user experience. So the way I would advise you to debug is to put the app on your phone and use it every day for a few weeks, and then once you found all of the bugs and the things that annoy you and fix them, then you should release it 34. App monetizaton strategies for iOS apps: So now that we have a good looking at, we need to make some money off of it. Now, if you're a freelance developer and you've made a nap for someone you've already made your money. Your part in this is more or less over. Unless the person that hired you wants you to make some more features for his app or to put ads in for him or something like that. The question is, if we have our own app, how on earth do we make money out of it? Well, there are a couple of strategies, and the 1st 1 is to charge for your app. That is the most obvious. And if you have a good app like Kingdom Rush, which is on the iTunes store, they charge $5 for it. And they have had a lot of success with this Siri's. But with that, you need to have marketing. You need to have a very, very good app that sells itself just on screen shots or on a preview video. At the moment, we don't have this level of app, so that is kind of out for us. If we had an exclusive contract, say with the BBC to publish their RSS feed. Then you could charge for your app because you have something unique that people want or need. As it stands, there are loads of RSS APS and we're competing in the marketplace of free. So the next strategy is to create a free app and then charged for extra features. So within our app, we could charge so that people could read things off line. Well, they could save things or they could share things on and again that does that extremely well. His clash of clans Everything is free to install. But if you really want to get ahead, then you have to pay for in APP purchases. And it's so successful, even got Liam Neeson to do a video spot for them. Some maps combine these two features so they charge for the app and then they also charge you for extra features, and Minecraft is one of those. You pay £5 for it, and then you can also buy things inside it. So again, you need to have a top up to do this. But interestingly, Minecraft only has a 1,000,000 reviews. Clash of clans has near enough 20 million, so free is a big motivator for people to download. However, it's different between the android and the Apple stores. Because android users expect a lot more free APS Apple uses. Expect more quality. So if you want to charge for a nap, your best bet is to actually create it for Apple. First, try it out there so you'll know if you'll have success on Android charging for it or not. Okay, then. Our third category is in APP advertising, and I don't need to show you examples of this cause. I'm sure you've seen it all over the place. This is where the APP has a banner that comes that pops up at the bottom of your screen. Or it has an interstitial, which is, Ah, whole page at advert. Sometimes this can be very annoying for users, especially if you plus to them everywhere. So it's a balance between annoying your users and making money from your aunts. In the next section, we're going to look at putting some non intrusive advertising into our app. Finally, you could get sponsorship, and that's just fancy advertising because you go direct to the person that wants to advertise. Let's say Nike and you say I will put your shoe advert inside my app whenever someone clicks on a shoe story. And that is worth gold to most, uh, companies, because that's really targeted advertising. And they will pay 10 20 times more what they pay Google. So that's an option. But it's only one to consider if you have a specific customer base. That's a for example, like shoes. Now, anecdotally from my experience and from reading about other people's experiences, Charging for a nap works If your app is unique, ours is not free. APS get downloaded a lot more than APS that a charge for the top nine out of 10 APS in both APP stores are free APS some of those use in APP advertising, but most charge for extra features. But bear in mind, that's just the top of the APP Stores were gonna be way further down, and we need something that puts us in people's faces and makes them download around. So we've already done that by making a good looking out, because that is most of the battle. As for how much money you can make out advertising, I would say if you had about 100,000 daily users, you could make 6 to £7000 per month in advertising sponsorship. The sky's the limit that is done on a deal by deal basis. So for our app, we're definitely gonna go with in APP advertising. 35. How to implement Google Ads in an iOS app: So let's put some Google ants into our search Google for ad mob and you come up to this page. Then we have an auction to sign in or sign up, and we can use our Google accounts or create a new Google account to do this. So I'm just going to sign into my account. Once signed in, go to the monetized tab and click monetized new app and then agile up manually. We'll call this beautiful feet. It's like your platform as I us and click add up, then select Brennan and leave the auctions as devote. Then you can give this a name. So RCIs item and when you press save it will provide you with an ad unit. I d get this page open because we're going to use this in a little while, then come over to develop his dot google dot com and such for the Google Mobile and SdK, specifically the one for us and download file the dealing, too. Once you've done that, switch back to XTs Cade and we need to start adding things into are linked frameworks or rather actually in our build faces. We want to linked binary with libraries click on the plus button. I want to find the following things. Do you want system configuration? Don't frame with you weren't message you. Why Frame lip. You got into kicks during work and we weren't both of these. We don't call Tiffany cool media cool graphics for years to Box A V Foundation and finally at support. Now the Google Robards STK should add these automatically when you first loaded up, but sometimes there's there are problems with it, so it's best to do more manually. Then go over to the file you just downloaded for the Google Mobile ads. Sdk unzip it and open the folder We want to drank in this framework item. So just venting me this two different screen switch to exclude so I can drag it up and I would ask us if we want to copy items. Let's click Yes and click Pinch. Now let's test that has worked by going toe web, your controller and inside here we want to get bored Google parents and then see that compiles. That is fine. So now we have the asked ready to go inside our application. Next thing we need to do is create a space for ads to do that. Let's go over to may not storyboard inside. There were going to make a U I. View inside of the Web view controller. It's a Clipper Web view controller. Open up the side panel to get our tools and things. Click the controller down here. Let's have a look like art objects, and what we want is right to the bottom. We just want a view se drank. When are to our screen. Then let's position it so it sits right at the bottom of our screen so we can add some constraints. Let's have it sent it horizontally. Then let's have it has zero spacing to the nearest neighbor, so it's going to drop it to the bottom. It's having as a wit or 3 20 and a height Oh, 50. And after history, then this update frame, and now we have it stuck to the bottom of our Web pew. Then we need to link that into our view controller. That's how we cannot be assistant editor. You know, I have the web you could solder open, and now I'm going to control click and drag it across as an outlet. Let's just drop in. Didn't you hear? Let's call this If you right click Command, you can close the assistant editor now and come back to your Web. Do you control it? Let's see if we can load up and add, and the first thing we have to do is change this bad. This band of you type two g 80 fan of you, then down. You know, if you did load, let's say load that has a new function. Let's create that function bunk load and then type one of you dogs at unit fighting is equal to and go over to your admin page and copy to add unit I D and paste it directly into here. Been we say band of you stocked route. Do you control it equal to so? And then we have to create a request. So let's say let request equal to a God request. My men somethingto add something to this request, which is our test devices. And for now, this is empty. But when you were testing around, you should get your test devices from the consul down here. When it's running, it will give you a unique I D for your device that you will put inside these quotes. And that's to stop you from accidentally clicking adverts. Because of Google Discover you're doing that, they will spend your account. Finally, we're going to load up our request, and that is just the one we've just created. Request. Okay, there's one other thing that we actually have to do. We have to come back to our main dot storyboard. We have to click our band of you and over in the inspector, the identity inspector. We need to change its class to and got banned, if you will, Advent of you. And so let's from them and see if we get some ads on the Web. You, Paige and we have a slight error and it's thrown an error on a band of you. So let's stop that. And I think that's because in my main dot storyboard have actually selected the wrong class . Let's start by typing Gap. There we go. It's a gap band of you not in advance of you. Let's press play and have a look so it opens our Web page and at the bottom we now have an advert accident that concludes, adding Admiral, into your IOS application 36. How to create an app icon for iOS apps: Let's create the APP icon for our app. If we click the main solution at the top and we click on the General Tab and we scroll down , we can see a section called App Icons and launch images. In here. We already have an APP icon defined. If you click the arrow next to it, it will take you to assets dot exe cassettes and in there we have to specify an icon for every single one off these images. If you don't have thumb, Apple will reject Europe. Now. Each of those devices has a different icon size that's required, and it's somewhat of a pain to create an icon for each of those. So what we can do is we can create our icon at a high resolution. So this is currently 5 12 by 5 12 We can save it as a PNG, so it's gonna puppet there and say, Are Isis, Icahn and PNG? Because it supports transparency. Okay, And once you've done that, go back over to the Internet and there's a great website called Make app Icon. Doctor Come. Alternatively, I have this great tool that I believe I showed you earlier in this series called Acid Catalogue Creator that will create an IOS icon. I think it costs something like £3 or $5 on the APP store, and it is well worth it. If you make caps, it's called Asset Catalogue Creator for those that want to download it. I'm just going to use the free Web version here, and what I'm going to do is just drop my saved icon in RSS icon. And what this does is it makes all of the images that you need, and there we have all of our images. It says Property and email address are just perfect one. For the purpose of this tutorial, I would ask you for a real one, so I'll put my junk one that I send everything to at Jean. Uh huh. And here we have all of the icons from Make have icon dot com, and it gives us Android I us and watch Kit so we can have it for all of those devices we just wanted for I us. And what we have to do is go ahead and drag these items into our X code, and we have to do it into the relevant spots, so I'll just show you the 1st 1 This is quite tricky to get right two times. Well, we could do, however, is simply to right Click and click Show in Finder. And then I'll just bring it up here. And once we have it in the finder, if we go back to the fire, we just download it and we go to APP, my conduct icon set. Let's just copy all of those straight into that folder, and if we come back to Ex code, all of that should be assigned now. And so now we have our APP icon. If I run that on our simulator, the APP icon should pop up on the main screen soon as it loads all hit home. And there we have it, and I think that looks quite nice. Actually, some snakes drank that. Want me to try and drag it into here to see what it looks like? I'm compared to everything else, and I kind of like it. And if I hit the switcher, we can also check what it looks like up at the top. And it's good now if you come to Apple's guidelines, they do have guidelines for What's an app icon should be If I go back one and they tell you an APP icon should portray exactly what your app does and for us, the RSS symbol is actually orange and white, and I've used an open source version of that and I've just painted it in our app colors. So when you're creating or icon, it should absolutely scream at your user exactly what it needs to do, and that concludes, creating an app icon for our app. 37. How to create a launch screen for an iOS app: Let's create a long screen for our app on X Kurds. Seven. Andi I'm using swift tube That doesn't really matter for this now. Prior toe I US eight, we had to use static images for the launch screen and just you know what a launch win is. It's a screen that displays to the user when they click the APP whilst the APP is actually loading, so it doesn't do anything special. You should use the lawn screen just to reinforce the brand of your app, to give your user a cohesive experience. Now, because our app is going to target, I also ate and later And if I just click this deployment target and make sure it is set to eight, we can use what's called a storyboard. So if you remember in the previous tutorials, we used main dot storyboard toe actually make the main screens of our app in our general tap here down an app, icons and launch images. We have a launch screen file and we can choose the launch screen dot storyboard. So if we open that because that's already there week, see that we just have a blank view controller Now what I'm going to do is I'm just going to drop in image in today, put a bit of light shading in the background and leave it at that. And the image of weights drop in is going to be something similar to this icon. So I'll just leave you for a second whilst I go and make one. And there we go. Now, uh, let you in on a little secret. RSS app is not very complicated, and you may have gathered that and there are plenty of competitors out there on the APP stores that do a lot more. But you have to remember that there are a lot of ab uses that get overload from too many features. They don't want a lot of features. They just want to read the feeds. They probably don't want to save it. They don't want to market, they might not want to share it. But you have to think about that yourself. And so how you can market Europe is you can play against what the big boys can't do, and that is simplicity. So they cannot say their app is really simple and then show all of these features, whereas us as just simple app. Developers can say Try our up because it's a lot simpler than these other wraps and there's no learning curve. You simply click a button. And once you've done that, every time you open it, you've got your feeds. There's nothing else to do. And so try to remember that people like simplicity, even though they say that they want features. And that's why I have written no bells, no whistles, just RSS. Now, apple say you shouldn't put any text in this launch screen. However, they don't enforce that and it's up to you. So just be aware that if you do put text in here, you can't localize it. So if this goes someone in China, then you cannot change this into Chinese as you can with other text in Europe. Okay, this is going to have a transparent background, so I'm just going to save that, and then I'm going to come back to you in a minute. Once it's ready to import into a rap. Okay, I'm going to use my asset catalogue creator to create my splash screen for my one x two x and three X icon sizes so If I select down here image set and I track and drop my final image into it, it'll give me a bunch of images from one X to three x on. We need to give the image and name, so let's have it at launch image and then click create. Then come on over to X code. Go to images dot exe cassettes and click plus at the bottom and then click New image set. And, of course, let's give this a name. Let's call this launch image and then it asks you for the 123 x, and I'm just going to drag. There's in from what we just created. So there's one to and three not go back to your launch screen dot storyboard, and we are just simply going to drop in a u I view or an image view into here. It's Let me just drag this subset. We can actually see it. Here we go. Yell if you see it before I do, I always get a little lost on these. I would get image you We struck that in and then, of course, we need to give it some constraints. Now my image is square. Let me just select the image of you properly here. So I'm going to give it a width and the height of, let's say, 2 40 2040 at theirs. And then I'm going to center it horizontally and vertically sets. It's right in the middle of our view. Let me just update that. And there we have it. And then, of course, we need to set an image for that. So over on the side here, it's just find. I write it the top under image for image view. We can have our launch image, and there we have it. No bells, no whistles, just RSS. And now we can change our size to see what it looks like on, for example, the six plus or an iPhone five. A full screen iPad. Yeah, I think that looks fine on iPad Pro. I kind of like the minimal look. But of course it's up to you to go for what you like. So I just saved that. And then let's run it and see if we get a launch screen that pops up on our simulator. There we go. So you see what I mean about the launch screen, reinforcing your brand, telling your user what Europe does and what's going to come up on. And that is currently trying to get the feeds. There we go. Okay, so now we have a fully unified sort of app experience. We have a long screen. We have an APP icon. We have all of these switching icons so we can switch between them and our user recognises a brand identity. Okay, that concludes how to make a launch screen in IOS eight and higher. 38. How to sign up for an Apple developer account: to publish our apple app, we were going to need an apple developer account. So jump onto Google and such for sign up Apple Dev and then go to develop a doctor, apple dot com slash register. And then once you're in there on a secure connection, we'll ask you to sign in or to create an apple. I t. So I'm just going to create one Wall Street cam And it will tell you you will last if your first middle last name your I d your past right and a bunch off security questions. Once you've gone through that and you've created an apple, I t. They need to apply to the developer program. So I'm just gonna go back and I'm going to look in with my details. I'm it says you've already agreed to the Apple developer agreement. Your screen will be slightly different. You'll just have to click through some things and sign up to the eye. US developer agreement. There are a few different agreements. I believe one is forced to firing. One is for I asked, and one is for Mac. For now. You just need I us. Once you've done that, head over to the member center 39. How to set up an app within your Apple Developer account: There are three places we need to set up Our app for publishing one is in your Apple developer account. The other is in your iTunes connect account, and the final place is on X code itself. The 1st 1 we're going to tackle that we have to tackle is in the member center for your developer account under certificates, identifies and profiles. And in here we set the identify for our app. So under IR saps, let's hit identify us. I have a bunch of identifies for my APs there, and we are going to create a new app, i d. So you need to have APP I ds selected and click plus. Then we need an apt description. So we will call this beautiful RSS feeder and then let's scroll down and it asks us for an explicit app, i d Let's make this the same as the one we have over an ex code. So in X code, under our general settings, we have this Obaidi. Let's copy it and paste it in. Then we need to select the app services that we would like with this, And if we looked down, we might want push notifications at some point in the future. But perhaps not now, and there's nothing else we really need. So click continue, and then that will be created and click submit. You can always come back and edit those items that you might need later on. Once it's finished, click Done, and now we have it in our list off APP I DS. Then click certificates and click the plus button to add a certificate. And the 1st 1 he want is I us Up Development and click Continue. Then it asks you for a certificate signing request file. And to get that, we need to open up key chain access like that and then under file or have a key chain access certificate assistant. We want to request a certificate from a certificate authority. We'll ask us for an email address. I'll just put a fake one in here for now for demonstration purposes and click saved to disk . Actually, I wouldn't put a fake one in. I'll put my real winning and click, continue and then save that to your desktop, and then you can close all of that, then come back over to the developer account. Click continue and upload your fire, so certificate signing request and then click generate. Once that's generated, you simply have to download it, and once you've downloaded it, double click it so it opens and it will install inside your key chain and then you are done . Then we're going to add another. And the IOS app development should be grayed out because you now have one. What we'd like is a production one. So app store an ad hoc click. Continue again. We provided with a certificate signing request Choose file, and we give it that file that we created and click Generate. And then you can download that and install it in your key chain. And then you are done with that section in order to run our app on a device before we submit it. And I would advise that you do that. We need to add its unique identifier into this website, so Wonder Devices click all and then click plus and then give you a device, a name that could be anything. So say my iPhone, and it asks for a U T I. D to get this plug in your iPhone, your iPod or iPad into your Mac and open up iTunes and come over to iTunes and click the iPhone icon. And in the summary box at the top, click the E. C I. D, and when you click it, it changes and you want the value that is you D I. D, which you can copy directly from there, and once you've copied it, paste it into here and click Continue, and it will load up that device for you when you click register. I'm not going to do it because I already have that device registered. Then we need to create what's called a provisioning profile, and this is what X Code is going to use. So click all at the bottom under provisioning profiles and at the top. Let's click Plus to create a new one, and we want first IOS app development. Click Continue, and it asks you for a nap. I d. So we want our beautiful RSS feeder, and it asks you to select your certificate. You should only have one, or you can select them both. That's fine. Click Continue. It asks you for the devices where they should be able to run, so I will select mine and asks for a name, so give this something obvious. Is a name so deaf? Beautiful RSS and that will tell you it's a development certificate and click generate. Once that's done, download it and then click. Add another and we want a distribution. So we want to the app store click. Continue. Select your app I d. Click. Continue select your distribution certificates and give it a profile name. So app store beautiful RSS and generate and go ahead and download that. And once those air downloaded, let's open them up and install them. So just go ahead and double click each one, and they should be installed into X code automatically. One further thing to note is that I'm just going to click. Add another. If you are distributing your app to uses that, say, want to test your app? Then you can get there ut I ds for their devices, and you need to create an ad hoc distribution profile. That's only if you don't have access to their devices if they need to install it over the air or through iTunes. I'm not going to do that here because it's exactly the same process, but when you do want to distribute your app to those people. You select your ad hoc provisioning profile to do it. The first thing we have to do is we have to click plus on embedded binaries, and we have to drop in the sq light dot framework I us. Then under linked frameworks and libraries. We need to select all of these frameworks, including goat Google Mobile ads. We need to drag them over to the link frameworks, and then once that is done, select your iPhone or I device from the drop down list and hit play. And if that compiles well, you need to unlock your device. And when it's unlocked, it'll transfer the app over to it, and it will stop running now. Obviously, you can't see this running on my device, but I can confirm that it is working exactly as it waas in the simulator. If you get errors around this building and running on your device, you need to pay close attention to exactly what those errors say, and then copy that error message property onto Google and you'll probably come up with a stack overflow page because everyone gets errors around this building and compiling for device 40. How to prepare an iTunes Connect app store listing - Basics: Let's prepare our listing for the APP store. Head over to iTunes connect dot apple dot com and enter your apple i d and password. Once locked in, click on my APS. An insight there we're going to add are apt to the list of APs. So click plus right at the top and click New App, and this is going to run on the platform I us and its name is going to be beautiful or assis feed Reda. Choose a language. Choose a bundle i D, which we set before in our developer account, and she was an SK you. This is just for personal use when you want to discover what is being bought or purchased from your app. So just simply give this a beautiful all right says that's never shown to the public and click create. And if there are no problems, I chains Connect will approve it. If someone else already has that name or something very similar, it will reject the name and tell you the reason why. But in our case, that appears to have gone through within the APP information screen that comes up. It'll ask you for the name your bundle I D, which you've already set, and it asks for some categories. So let's click this down. And this, perhaps, is under magazines and newspapers. It could be news. Could be, has a few things that could be. You can also choose a secondary one. Singers. We're not quite sure. Let's have entertainment. You may need to set a privacy policy. It depends on what your app does. For now. Leave it blank. But if you submit for review and they say you need one, then you'll have to put one in that's press safe and then down below its click pricing and availability, and we need a price. Our app is going to be free. Yours could be charged for It's completely up to you and bit code. It's optional if you want to set this bit Code Auto Re compilation. But let's leave it off. For now, it's click save and down below, where it says IOS app. It says 1.0 prepare for submission. This is where the majority off your work is going to be done inside this listing, and once you have all of the information in here, you can click right at the top here, submit for review. So the first thing we're going to have here is a description. Now bear in mind that all of the search engines will index the APP store. So your description had better be a very good description of exactly what Europe does. And you should let it contain keywords that people might search for on Google or on their iPhones. And you can also put keywords in this box. You can have a support, your l and a marketing you're out. So let's go ahead and do that. And there we go. I mean my description. You'll notice. I've put RSS in it and feed and reader and I've used it a couple of times. So Google really gets the idea that this is a feed reader app and then in keywords, I've put lots of possible permutations of the keywords people might search for. All right, that's the basic app store listing. So I'm going to click. Save for that and then if we scroll down, we have an option for Apple Watch were not compiling for that so we can leave that empty the build in a later lesson. We will get onto submitting that we won't do that now. And if we scroll down, we have some general information required like an APP icon. This is different. The icon you set in X code. You have some information that Apple requires you to display, like a registered company address. It asked you if you need Game Center, which we don't, and it asks for at review information. So I'm just going to pop my name in. And then when I switch this off phone number and an email and when your app is reviewed, if there's a problem, Apple will email you or phone you. If it's a major problem. If you need to log into the app, which we don't, they'll ask you for a demo account so they can test it all. Finally, once they've reviewed it, if they approve it, you can either manually release it when you click after the approval, it can be automatically released once it's approved, or you can automatically release this version on a specified date and time, and I would always go with this last option. And that's because you get a peek in APP installations, and if you have a search on Google around your own market where your app is, you'll be able to discover what that peak is because even if your app gets featured on the APP store later on in its life, your peak downloads were still be at the very beginning when you release it. So that is a prime window when you want to get all of your new customers on board. So when you first release it, the priority number one is to get those initial adopters. 41. How to prepare an iTunes Connect app store listing - Images: Let's create the screenshots for our app inside iTunes connect. So if you're not blogged into iTunes connect, go ahead, lock in and go to the out listing we created earlier. And in the out listing, you'll notice there are six sections in the preview and screenshots 4.75 point five, etcetera, etcetera. And these correspond to all the IOS devices that your APP will be able to run on, and you need at least one screenshot in each of these Now Apple are very strict about for Screenshots. They must be off a certain size, and I've just pulled up the iTunes connect. Develop a guide, for example on the iPhone. For you need these any one of these sized images and it must be 72 DP, I argued, be flattened with no transparency. That means you shouldn't save it is the pain really should save it as a JPEG in it for the iPhone five, the 6th 6 plus the iPad and the iPad pro. And that's a lot of images Teoh be doing with at the moment. So if we come over to photo shop, I've created templates for all of thumb at all of those various sizes. Now, if you create an image and in iTunes connect, you try to upload and it's the wrong size. So I'll just show you what happens if I upload a random image here. It says my dimensions are wrong, so you have to get these right. Apple also say you cannot have a picture of a phone or a device inside the Screenshots, but I've never heard of a nap being kicked out of the APP store for this. So it's up to you. It's on your head if you do it. And I doubt Apple would kick your app out. And in my opinion, it looks better when you have the device on it and you have a lovely label across it or something like that that tells your user what Europe does. So I'm just gonna go ahead and create something and come back to you in a second. And here we go. I have created six images, one with an iPhone four on Earth of 56 a six plus the iPad air and the iPad pro. And if I was you, I would do something similar to this, and then I would save all of those for future up submissions. Now we need a screenshot of what our app can actually do. So let's come over to our ex code and let's fire up the simulator and then the simulators very handy, because it takes a screenshot at the revel the resolution off the actual screen so we can hit. Where is it? Let's see now. Hardware device note debug at it. There we go. Save screenshot under file. And so now that has bean saved. So if I just open that, I can then import that into here and if I transform it inside photo shop. Actually, this is an iPhone six off to put it in here, and it's almost pixel perfect already just requires a little bit of tweaking. So let's just move it up and let's transform it. And there we have it. Okay, that's great. I'm just gonna save that. Now I'm just gonna upload one or two into my iTunes connect. So it's up to you how many you want to upload, But we are going to add a little bit of a snazzy feature so it jumps out at the user when they're browsing the APP store and there we have it. Just a nice banner that six across our image that tells the user exactly what's going on. And then all we need to do is save that as a J. Peg, and I will call it exactly that and then put one on it. So we know it's our first screenshot, some 50 by 13 34. And then let's come over to our iTunes Connect an insight 4.7 inch. I'm just going to drag this up from my desktop. You can't see it right now because it's on the other screen, and if I drop it in there, it should upload without any issues. If there are issues, Apple will be quick to tell you. Now this screen comes up when your user has clicked your APP icon when they want to download it. So this screen will either encourage them to download your app or prevent them from downloading around. So you really, really have to tell them right here exactly what your app is about. Okay, I'm just going to create all of my other screenshots. I'm going to upload them and then show you what that looks like in a second. And here we are. I've got to screenshots for each version off a device and you can see what they look like. They're okay. I think I'll add a Web view controller for the actual latentview to let my user know that they can also browse those stories. But I won't do that in this tutorial because you get the gist of it now, right? So once we've done that But before I carry on, I just want you to see that there is now a consistent theme going on between our app icon, the screenshots and all of the colors that I'm using and uses these days will expect that the final thing that we have to add image wise here is the APP icon. And this is slightly different to the actual icon we put within our app. This is just a fixed file So that iTunes Kenly list you're at placing with an image and this if I just put around a picturing, it'll tell me my app icon must be 10 24 by 10. 24. So I'm just going to create that now I'll just upload it just made it 10 24 app icon And there we get there is our app icon. So everything has a nice, consistent theme now, So I'm just going to say that and that concludes all of the image parts off our iTunes connect listing. But the one thing I want you to remember is that the iTunes connect images are the things that entice your user to install your app. So I'd advise you to spend a little bit of time here thinking about who your potential users are and how they would view Europe and what would make them actually install it over another app. 42. How to compile, sign and submit an app to the App store: Let's release our APP onto iTunes. Connect now. To do that, open up your project in X Code seven and click on the top level tree folder, Then click on bailed settings and scroll down until you see code signing. If you can't see it, make sure that all is selected the top and levels now under code signing identity, click it down and click I US distribution now. What it should do is automatically apply the provisioning profile that we created much earlier on in this tutorial. Siri's now come up to the top left, and we want to select our build only device, which is a generic IOS device and right at the top hit product and archive. And what it's going to do is build it for release. And once that builds go on up to window organizer and it opens up all of the apse you have available in your portfolio, click on our out beautiful RSS feeder and click upload toe app store. Choose your team if you have to, it will prepare the archive, and then when we click upload, what it's going to do is it's going to go through a bunch of checks and let you know almost immediately Assumes is uploaded if everything is OK, and now that is completed. So I just click done and I will close this screen and it goes back to Ex Code. Now, if this doesn't work for you and it's a common problem, go to product, do a clean and then a build. If you get an error on your submissions or anything like that, simply put it into Google and someone without a doubt has been through it before and just follow their instructions. They're generally very good on Stack Exchange, and they'll tell you what your options are for fixing it. Let's go back to iTunes Connect, and if we scroll down and we click our plus on the build, it will tell us we have version one currently processing. Once that's done processing, we can select it. If it doesn't appear in this plus menu, then simply cancel it and refresh the page, and almost 50 minutes later, it's still stuck in processing. Now, sometimes this happens with apple. They haven't officially acknowledged it, but all of you, the developers have because it's happened to all of us. If you get this stuck in processing for more than a day. You should come back to ex code increment, your build number by one. So let's call this, too. Every time you submit to iTunes connect, you have to incremental build number or your version number, and you can never rolled back in time. Once you've done that, go through the steps for building it for release again and submit to iTunes. Connect again because sometimes that processing ah sign never goes away, so it stays stuck forever. It won't affect anything that you build, but just be aware of that. And there we go some 12 hours later. Finally, I can select my build of uploaded to just in case. But I'll select the 1st 1 and click done. And once you've done that hit, save and then we have to set our rating. So underneath APP icon, just click edit on rating and it asked us if we have any of the above. We generally have none of these. No, no unrestricted Web access. Yes, it does have that technically gambling and then click done, save and then submit for review. I see. Does your app have cryptography, which is note. Do we have the rights to display or access third party content? Well, yes, because an RSS feed does imply that, right? And yes, on the advertising identifying we do use it because we use Google ads. We only use it to serve ads. We don't do anything else with it. And then you have to sign the agreement, and then you have to hit, submit. And then once that goes through, you're going to have to wait about nine or 10 days for Apple to actually get around to reviewing it. And in that time, if there are errors were not happy with something, they will tell you you'll have to change it, compile a new build, so you'll have to increase this build number and resubmit it to iTunes Connect. And then they will have to review it again with another 90 10 days. So it's worth your time, actually, making sure that your app works really well on version one. Okay, that concludes submitting your app to the APP store 43. Final lecture with 1 final task: end of this course is one thing left for you to do, and that's to download this book called The Swift Programming Language by Apple. It's completely free, and you can view it on in iBooks on an iPhone or a Mac. And I'll leave you with one final task. And that is to sort our list of feed items within the app that we made into sections you might recognize thes from I us. You haven't index on the right hand side, and you can just drag your finger down it to go down it alphabetically, see if you can implement that. It's not that difficult. All that remains for me to say is, thank you very much for listening to me on this course. If you've enjoyed it or if you have some comments, then please do let me low in the discussion. If you really, really liked it, please let other students know. And if you'd like, write me an honest review that appeals to perhaps the students that like my the way I teach or the tone I like to teach in, Ah, not an exciting manner, but in a clear manner because I believe that's important when you're learning, it's all well and good to be excitable, but to learn, you actually have to listen properly, and that's how I try to come across. So if you have any comments about that, please feel free to tell me. Finally, if you'd like to learn some android programming or even cross platform programming, simply have a look at my other courses. I do native android with Java, and I do cross platform for I US Android and Windows phone using Zamarripa. So if you'd like any of those and you'd like a hefty discount, simply message me and I'll sort you out. So once again, thank you very much for your time and attention.