[3/3] - Twitter - Real Time Database with Firebase 3.0 | Sandra L | Skillshare

[3/3] - Twitter - Real Time Database with Firebase 3.0

Sandra L, Front Development

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
11 Lessons (1h 3m)
    • 1. DataBase Reference

    • 2. Sending & Saving Tweets

    • 3. Date Formatter

    • 4. Table View Controller

    • 5. Table View Controller

    • 6. Class Tweet

    • 7. Displaying Tweets

    • 8. Text Format & Row Height

    • 9. Displaying User's Avatar

    • 10. AppTransport InfoPflist

    • 11. Debbuging


About This Class

In this class, you will learn about the new Firebase SDK to enable Twitter authentication and save tweets records in the cloud in real-time.

This class is part of the 3-part series to build a Twitter Clone:

  1. Twitter Clone - Animated Splash Screen
  2. Twitter Clone - Twitter Login SDK
  3. Twitter - Real Time Database with Firebase 3.0


Prerequisites & Requirements:

You will need access to a Mac computer running OS X 10.10 or later No prior programming experience is required. The course has been specially designed for beginners. The first chapters will walk you through the download and install process of the XCode 8 Application (to build iPhone Apps).


1. DataBase Reference: So we're back and fire base where we're gonna find so more instructions as to how we can save so we can write as to how we can write to that a base. So we're gonna go to get started for violas, and we're gonna find the section for this time. Real time database get started for Iowa's, you see. So we have already done this part, which is to enable fire bays for, like, install the fibers is decay, etcetera. So now we're gonna need to also enable the pod. So we're gonna install that Jim so we can actually use the database service. So we're gonna go back to the terminal. So I have this one. So my product saved on the deck stop, and this one is named Twitter clone. So navigate to your projects and you're gonna find to the punch files. So I'm gonna open this one so directly in the terminal using now I know you can also use vine vim V. I am. So I'm gonna use no, no. And from here, So I'm gonna dates My So I'm gonna compete right here. I'm gonna date my, um what fell to include this one as well. Ok, say come and see. And then exits. That's gonna be control X when I click. Yes, to say this one and then exits Next step. We're gonna dates our part, fell to then install these new pods. Maybe this one database. So then we're gonna look so we're going to read So how we can actually use So the database features so we can actually write to the database a year ago. So that's completed. So we have successfully installed the fire base database pod Perfect. So we can't go back. So this part is done. So next. So we're gonna need to then, um so here you have all the explanation. So we have already done this part to configure five days now, we're going to look at how we can actually connect to the database, so we're gonna need a reference to the data bees like so? So let's begin with bets. And for this in tax just to explain. So that's fairly simple compared to the old as decay. If you have already worked with five days before. So with the Newmans decayed, So basically, you don't need to specify like the address the cereal to your database. So if we go to the console, I had already this one open right here. So if you go to your console, so let's go to you're corresponding Project Twitter clone. So if you go to the council and find here database you're gonna find so this, you know, address the zero that corresponds to the location of your database. So we don't need to refer to that soldierly anymore because this one is specified. Actually, in this info police Google service in for police right here. So we've got, like, a reference to the data bees euro. So instead, So what we're gonna do it is just in a tweet view controllers. So we're going to need you then, first of all to import fire base. But then we're going to import. So the fire bees that of these, then we're gonna create a reference to that database. So we're going to do that with ref. I'm going to simply call it like that, and that's gonna be fire database. Then data bees reference like so. And the other thing I'm gonna do right away is creating something that I'm gonna need to configure later on, which is gonna be like the reference to the twits, meaning that we're gonna have, like, we're gonna look at how this is structured. But the way this is structured, it's like adjustment for month. It's like a tree you're gonna have, like so them highest level of the truth, which is like your console, like, right here you're gonna have, like, the highest level off the truth, which is gonna be like your database. And then inside this reference, you're gonna have, like, all the references, referring to your data that you're writing, we're gonna need to include So all the data for the tweets to one specific diabetes reference, and we're gonna create this one with fire base of this class gonna be fire that of these reference like So So this is how we're gonna be initialized this one, and finally. So we, um, create this one, right? Right here. So record this one right here and then invaded load. Basically, some just put, like, here, five days, same here as well, just to distinguish everything okay. And here, So basically, we're gonna do tweets rep and then make this one a culture riff and we're gonna have a child. So I'm gonna show you that right away, and this new wrench is gonna called is gonna be called twits. So this is where we're gonna include save all the tweets in real time. So let's look at the documentation again, retriever. So you can actually find so more details right here in the next steps, learn how to structure the data in your database. Let's look at that. So, basically, you're going to see that this is structured that way. This is like a Jason tree. Well, that works like a dictionary. You're gonna have a collection of key value pairs. So first of all, so here you have, like, a good example. So let's say that you have, like, contacts or users in your database that you want to save. So you'd have, like, a main users branch than a specific branch for every new users and then a specific branch for every new user. A new entry, Then for every user you'd have like to information corresponding to the name. So that is the key on the left than the value and another collection that corresponds to contacts. Okay, and so forth and you're gonna have, like, more details as to how to structure your your database following the Justin Tree formats. So let's read now. We can, like, read and write Dita, so this is gonna be, like, the next step. So we're gonna look at Swift each time. So basically, so the type of data, the data type that you can save too. You're five days database will be objects of type and a string, and this number dictionaries injuries. So we're gonna use, um, actually answering objects to save, uh, the texts off the tweets and also the dates. So we're gonna save those two information, and you could also include a user. Between now, we're just gonna use the example of one single years are, well, that database, and this is how you structure your data. So basically, you refer to the main reference that we have right here that corresponds to your database. Okay. And then you're gonna add a child, so meaning that right inside your true, you're gonna have, like, the next truck lower level, which is gonna refer to users in that instance. So we're using that example of users and for every users So you're gonna have, like, first, a main branch, a main, um, level, which is gunning for users, then inside users. You're gonna have, like, other specific references for every user and here were choosing to refer to them using the unique identifier. So this is how you create the name of the branch. And finally you set a value for that branch that corresponds to the data that you want to say. For example, you want to say, like as we were saying so we want to save the text of the tweets and also the dates when this was saved, so later, So that's gonna be next to how to read the Dedeaux. So we're not going to get to that just right now. So actually right here? I think so. This is to update to delete. So that's gonna be no when I look at that. Okay, So let's go back because I think you had also like this section which is saved to real time database. Let's read. I think that's the same read and write looking, that's it. Seems so basically. So this is what I was explaining. So first you've got the ref, they were going to specify another lower, uh, level in the tree for responding to twits. In that instance, you're going to see as soon as we start actually saving writing to that of these, you're going to see how, like how this works, we're gonna have, like, an extra branch for the twits. And then we're gonna create a new twits inside the twits branch, a new specific tweet that corresponds to the message that we want to send out and the dates 2. Sending & Saving Tweets: so in the last video. So we have just created a reference to our database, like so and we're creating. So these new reference, which is gonna corresponds to one tree level for the twits and then this is at this stage when we send the tweets of the central action that we're gonna create. So this tweet to save to, to write and save to the database. So what we're gonna do here? So basically, we're gonna have, like, different objects, starting with the tweets itself, and this one is gonna corresponds to the texts in the tweets texts You. Then we're gonna also have a date that for now, which is going to simply generate, like so we're gonna use the functions to format this one nicely. But that's maybe later. Then we're gonna have, like, another twits reference, and this one is gonna be like another reference, which is gonna be specific to, um, I'm just gonna specify this one as being like, what's the class? It's this one like, so we're gonna have another reference by a biz database, and this one is gonna be like for every new tweet. We're gonna have another reference to the twit, and this one is gonna be, um we're gonna create this one. So from the twits, ref, you know, that's gonna be like all groups inside this twits level, and we're gonna create this one with also it shelled and interview to make so every new entry unique we're gonna use the dates. So every dates, objects, so it's gonna be generated. So each time, it's gonna be unique with, ah, date and time as well. So we're gonna be able to use that as a unique reference. Looks like it doesn't like it that way. I'm going to need to actually use I think a string objects. So we're gonna use that this is expecting objective types drinks. So we're just gonna put this one and that's interpolation syntax. That should be fun. Let's see, Tweet rough is optional. Okay, so now So what we're gonna do is we're gonna actually set the value for that in your reference, meaning that it takes dictionaries also in the real time database. So we're gonna create the tweets dicked. So we're gonna have a collection off key value appearance. So that's gonna be a type Ennis dictionary. So first we're gonna have, like, the tweet equal to in the tweets. This objects the top, which is like, the content of the text you. Then we're gonna have another kid, which is gonna be the dates equal to dates automatically generated. And finally, we're going to set the value of this tweet ref Nutri trip. So that's gonna be out tweets said value. And this one is gonna be we're gonna pass a tweet Dict dictionary as a parent. So this once of this dictionary is gonna be saved as a new entry in our identities. So that's gonna be each time, in your reference, so referencing Sue and you date Okay. And then finally, we're gonna allow also to dismiss this prison view controller. So once we're done, it's gonna be true. And then completion is gonna be No, you could have something like triggering something. Seemed like your tweet is sent, but I'm gonna leave. I'm gonna leave it. Neil. Just gonna change also here. I'm gonna put Twix sense gonna change it right here. Okay, uh, now So let's actually try that for now. We've got nothing in our console in our database, so this is empty Let's try to send a twit. I really strike another. Hello. Just hello and tweets. Okay, so it looks like we've got something not right here. So I'm going to read. Can only store object of type. And it's number in history. And it's Nigerian in history. OK, so that was what I was saying. Actually cannot store, object of type and estate at dates can only store objects. Okay, so this is what we're reading here, so and the documentation so we can only store date out. These types don't know what I did for summers, and so I may have missed something at this level, but I think ahead, let's go back to, um sweet of you controller. So I think I was using actually like, Oh, my bet. Yeah. So, actually, I'm going to use the exact sense in text here instead of using just date, because now, like here, this is the object of type date. Whereas we want the string objects. That's why. Okay, so now we're good. So we know that we are sending an object up type in a string or string, whichever is fine. This story that again so hello again and then sweets. Okay, Tweets sent. Let's see if we actually have something in our console. Okay? It looks like it is okay. Perfect. So we've got our new tweet that we have saved and, um, that we have sent and saved in our real time database. So we got the dates as a unique reference and the tweet text that corresponds to handle. So just the one that we have saved. So just the one that we have typed in the text you. So what we're gonna do next is actually allowed to format, so this dates nicely. So we're going to do that. What else? Um, so we're going to do that. So what we're gonna do next is allowed to ferment nicely. So these date, actually, we're gonna use, like, a function separately to promote this one nicely, and obviously so the next step will be to then be able to read from the database. So and obviously the next step will be to be able to read from the database so we can actually display the tweets that we have just saved. So you see that we go back to the stable view controller and be able to read the tweets and the stability 3. Date Formatter: So we've been able to save our first twits and I were console database, and what I wanted to next is to allow to ferment so nicely this date. And what I want to do when I want to be able to do is to format nicely. So this date value. So I'm gonna add another function. So actually, I'm gonna put it right here, and this one is gonna be named display dates. And actually, it's going to return value. So it's gonna take, Yeah, just it's gonna return. And so it's going to return and objects. So we're gonna get so that's gonna be the current leaks type date. We're going to generate a new objects date. So each time that we click on sent tweets, I'm in twit. Then we're gonna specify so a date style First, I'm gonna need to have, like, an objects of type date for a matter. So this is what we're gonna use to format. So this object dates. So now we're gonna then specify. So for matter, which is gonna be with date style, So we're gonna use long, so meaning that we're gonna include so the dates So the the day the details of the year. Then for the time also, we're going to specify So this town time still and this one is gonna be medium. This is actually in in him. So we're gonna have, like, different type. If you type duct, you're going to see, like, the different options, and we're going to select medium Okay, you can also have full. If you would like to have, like, the full, like hours, minutes and seconds, for example. So you can try the different options anyway, So I'm gonna select medium. Finally, we're going to return this objects because this function is expecting a return expression, and that's gonna be for a matter. We're gonna been return his strength from the date objects and that's gonna be current date . And basically, we're gonna call this function so far from this sent tweets action. And instead of having here dates, it's gonna be actually an object off type. So that's gonna be displayed dates that's gonna become like an object of type string. So we can then replace here with dates and we can feel safe that it's not gonna crush because we know that this is an object off type string, which is returned. So if you do option, you see that this is returning. So the returns i p strength so we can feel safe. That's is not gonna reject. So it's not gonna reject our dictionary because these are only values off types. Train as expected. Let's try. That's we're gonna send another twits. Let's try another tweets and low words. There you go. Tweet go tweet sense. Let's check in our database year ago, November 6 perfects Ah, yes, that seems right. Also, I don't think we're gonna use um, November 6 2016. So that seems fine. I think I'm gonna change for the time after that's really up to you. Uh, instead of having medium what else we have, like cool, I'm gonna too short because of the way that's still okay. So anyway, I'm gonna keep it, as is what we're gonna do next is allowed to then read from the Vietnamese because we're gonna need to then display out tweets in the tweets table view controller. And that's something that we're going to see next 4. Table View Controller: So now we aren't in the table view tweets, table view, controller so that we're going to configure because here we have, like, a table you control, which is a subclass of your table view controller. So automatically So this is gonna be connected to the data source and delegates, so we just need to then update those functions in order to indicate the appearance of that people use. We're going to do that right here. So we're gonna start by simply checking that this is working just as expected for this table view, we're gonna need to specify also and I don't see fire somewhere change Just one, right, you twits sell. And it must much what we have in the story board. Let's go back, subject the prototype cell and here we're going to specify so not here, actually, right here. Okay, so you're gonna make sure to select the prototype cell and then provide with one identify your right here, and that is very important because in order to be able to generate a prototype cell, it's gonna be generated. So as many times as you have objecting a collection so here we want to then generate a cell a row. So for every tweets that we're gonna get back from our fibers query, and we're gonna need to then specify so and identify your energy to then generate those ones. Problematically. So we're going to do that in the tweets table view controller. So make sure that this one matches the one that you have specified defined in the story board and then to check that this is working just fine. So we're going to simply just generate like, um so with background color and what I'm gonna do is actually using So, uh, uh, this color that we have right here that corresponds to the Twitter Brandon colors and we're gonna allow to have, like, the Alfa changing as we go, like, go through each row, each cell. So let's say that like, we have 10 So we're gonna use the index by through so the value of the index back through. So this is an integer which is returned. That corresponds to the index position that we have in the collection, and this one is going crystal as we go through every objects. So, uh, can I use that? Yeah. Sorry. I'm gonna use the interpolations to pass this as a value here. So that's gonna be although no, that shoot. No, that's not fine. Because the other fights supposed to be afloat, so that should be floats and then index bathroom. We'll be confused here. So first we get the index bathroom, which is an integer. So we need to convert this one into afloat. So it's accepted. And I think that this needs to be actually a siege afloat. Even better. Okay, so this number, as you know, is gonna increase. So we have already seen this multiple examples with the table view this one is going to increase for every so for every row position. So we go all the way to 10 So we're gonna have 10 rows, and the color is gonna increase like it's gonna get like, um, darker as we go up those dry. That's so we're just checking that the data source methods are just connected properly. To begin with, the next step will be to obviously display outwits in the table of you. Control it. Let's check. And here go. Although that doesn't seem to change its the same color. Okay. Not sure why? Oh, and I know why. Actually, so just to create, okay? And we're gonna need you, then divides So this by 10. Because this is like, um, 10 rooms that we have in the collection for now. Okay, So perfect. So we know that this is working just fine. So we've got 10 rows for now, so we're just choosing to display, like, a color. So ultimately, of course, we're gonna have, like, the twits. So this table of you is gonna be used to this way our tweets after reading. So after doing a query to the devotee, so that's gonna be the next step. So we've got our table of you and next we want to display tweets. Let's see that next. 5. Table View Controller: So we noted to read from the database, we're going to need to have a connections to the fire base 25 days as well. So similar to the tweet of you controller right here. So we're gonna cup. He actually from here back to tweets table view. So I'm gonna pace this, and I'm gonna need also a reference to the database, like so very similar. And we're gonna piece this one right here. And also we're gonna need to then initial, like this one as being so that's gonna be going do that injured it loads. That's gonna be twits, Ref Childs? Uh, no, my bad. Yet to its ref, we can choose to its rep and then it's gonna be ready, child, and maybe tweets. So basically what we're doing here, So that is actually different. We create a reference that we can then access to that's connection right here with you twits. So we have a connection to the fire base. Then we want to read from this treat this segment that corresponds to the tweets. So we're gonna do a query to then return every objects which is saved to this twits. True, right here So this is what we're doing here. So that's why re initialized this one right here at this level. So then we're gonna have a sections for five days. I'm gonna call this one. So funk curry five days and this function is gonna be used to actually return a collection of tweets. So after reading So the fire base that's gonna be we're gonna have, like, twits read, call it's and history and that's gonna return void and how it works. So we're gonna actually read the documentations before we go any further. So here, we're gonna have, like, more to tells us, too, how we actually get, um, value back from fire base. So we're gonna get a snapshot. So we're just gonna be up type fire bays, data snapshots. Let's look here. Yeah, right here. So this is how we're gonna structure. So how we can read from the data bees so it looks like this one is for a single evince, but basically, we're going to get the value back from a snap shut off type fire database snapshots, and we're gonna get that as an annex dictionary because whichever data that we get back from five days. We're not gonna be able to do anything with it. We're gonna need to convert that into an object that we can actually use and manage Handle on. Okay, that's I think about it. So I'm gonna show you that and dysfunction. So that's gonna be we're going to read from twits refs, and that's gonna be observed for the event type. So what we want is to get the value, and that's gonna return an object of type higher data snapshots. So I'm gonna name it snapped shut. So this is what we need to back. And then basically, So we're gonna get I'm gonna name this one. So as an item to begin with and this one is gonna be like snapshots value as fire Dedham snapshots like so And finally, we're gonna create a dictionary from these snapshots of mistake here. So that's not the value that's gonna be snapshot as hired it a snapshot morning. That's gonna be the starting points, okay? And finally, So we're gonna then get a dictionary and I am using and finally, and finally we're gonna then create a dictionary with this optional chaining and wise because you're not assured to have, like, object existing in that fire base database. So that's where we first check if there's actually values. Uh, and if there's anything back, so then we're gonna be able to then assigning to addicts, it's gonna be item value as and this dictionary. Okay, so we want this one back as a dictionary that we're gonna be able to handle, and we're gonna check again. If we actually have, like, twits, that's gonna be again. So if let's toe, it's dicked as dicks as an ex dictionary. So we had, like, difference step. So to control the flows of first, we check if there is a value that there's a value back corresponding to and item value for the snapshot priority. Nice snapshot. And then we check if we actually have values before the corresponding values dictionaries for this one. Okay. And then we're going to be able to then, um, get the value. So then we're going to specify this one as being so and because this is the collection. Okay, I'm gonna need to put this one as optional because this is a optional chaining. And because this is a collection, so we're gonna need to look through each object that we haven't. That dictionary twits. So right here. So if you look in the console so you see that the tweets corresponds to a collection, so we're gonna need to look through each of them in order to return. So the corresponding values that we have in it So we want to get, like, the text of the tweet and the date of the tweet it's gonna be tweets text that corresponds to tweets. And this is the name uh, I don't remember what, uh, tweet speculates to it. Okay. Could have put text who got his twits on. This is as the string. And then we're gonna have, like, the deat, and that's gonna corresponds to the key for the dates right here, you see, and also as strength because we have saved this one has a stream. Then we're going to create, like, the new tweets. OK, we've got an air here, and I'll explain why? Because rate years of this is like returning back. So we're are looping through every object tweets for every tweet into it sticks, although extra doesn't know. So the type of object that this is So we're gonna need to actually, um, make sure that we specified this one as being a dictionary, okay? And I also know that it can be treated as addiction er at this level. So that's something that happens often. So when you get object results back from any source, like data from any source, which would be also using defaults, you're gonna need to specify the type of object. So it's not confused. So once this is Clary fights. So we're gonna be able to then a new object, which is gonna be like a new item. And that's something that we're gonna do next. Actually. So what I want to do is we're using so a completion rate here tweets array. So basically, we're gonna have a local durable here, just one of your ear, and this one is gonna include objects, some of type tweets. So I'm gonna create that next we're gonna have, like, one that specific class which is gonna be used to initial lights, So unobjective type. So we're gonna create that next 6. Class Tweet: Okay, so we're gonna make a little break. So, actually, is this part of the same scenario here? So we're going to see how to create from the fire base. But I want to create a specific class for every new tweets. But we're gonna then display in our table. You on this one, we're gonna call it so this new father is gonna be tweaked. So that's gonna be class twits it's gonna take, actually. So that's gonna be used to describe every tweet. It's gonna take one. It's gonna be texts type strain, and then the dates also string. And then we initialize this one. So obviously with an innings, so that's gonna be text type string for every new tweet objects of types drink as well here . And then it's gonna be so text equal to text and then dates equal to dates. Okay, so we're done for that parts. So we're gonna be able change allies. So every new object tweets using this initialized right here. Okay, so let's go back to our table of you controller. So now So we're gonna create. So as we're saying so, one local variable. Now this one is gonna take like her raise with object of type twits, like so and for every object that we get back as a result. So when we do our query from five days, we're gonna creates, like and you, right, um, and then initialized this one with this initialize er to create in your tweets, like so So that's gonna be the text. So that's gonna tweet text, tweet, text, and then the dates, which is gonna be specified with tweets date. And then we're gonna add so to this very local variables So every new item that we get back as the results and finally we're gonna get this completion that we're going to be able to then use. So let's stay organized here because we have different blocks. So first we've got so the four. So this is our for loop right here. Then we've got the If So the optional Cheney, then we've got another East. So at this level, we're gonna be able to then around our completion and then pass. Hurry. So this array, we're gonna use that to then, uh, displayed in our collection, you know, in for a table. So that is something that we're going to do, actually, right after as a necessary. Okay, so that is something that we're going to right after. So, actually, let's begin by testing dysfunction. So from beauty lewd, I'm just gonna specify here, Fire base. So I'm gonna call this one. So right here to print. If we get something back from these query five days query firebase, then we're going to return in a re. And that's prints, actually. So whatever we have in battery okay, to begin with. Okay, so let's start with that. Okay? So it looks like we've got, like, a few things that we're gonna need to correct fix. Let's see, what's the error is for. So when you look actually at the tills at the details here, so looks like we've got, like, objects back. So to keep value appeared, that corresponds to the object that we have saved in our database. It's at this level that this is actually feeling tweet item to it as anise dictionary. Now, that's because I should have actually presided that I want this as a value. I want the value of the twits and not just the tweets. Let's try that again. Okay, so here ago. So now you can see that we can get, like, the Twitter, the tweet object back, which are type tweets financial. We're gonna read anything because we're just returning the tweets objects. So ultimately, what we want is to any ways to return the objects. Um, Twits, We're gonna have another global variable here, So which is gonna include objects of type sweets? So we're gonna do that next we're gonna have. So I'm gonna actually created two right here. So that's maybe twits of type twits. What? That tweet we're gonna and you should like this one right here and after that. So we're gonna complete so the rest of the applications to then allowed to indicate. So with the later source methods Hominy Rose, we're gonna need for that table view based on the number of objects results return after the query and then configure right here. So the cell, so each cell. So we're going to do that next 7. Displaying Tweets: So now we have, like, tweets that we get back. So of course, records, objects that we had, like former Leeds, specifically for the application. So what we're gonna do So instead of just printing the array right here So we're gonna then allowed to refer to the tweets that we get back here a rate as and hurry with objective type sweets like so. And we're gonna need to also reload the table. That's gonna be with self table view, reload data. So each time that the reason you objects in that collection So we're going to reload the table, you then we're going to refer to that collection twits and then return. So a number of objects. So that's gonna be a number of rows based on the number of objects that we have in that collection. So if this is two tweets, we're gonna have to rose. And if it's is And if this is 10 tweets, it's gonna be 10 roubles and so forth and here instead, so we're gonna be able to then display, So that's gonna be firsts. We're going to refer to one that a specific object that maybe let twit that's gonna be twits Twits The collection and then index path Peru. Okay. And then for each text label on the text, we're going to then be able to then return. So this is tweet text, okay? And we have also the detailed text label. So let's go back to the main story board to allow to, um, display more detail. So we're gonna use instead of custom, we're gonna use, um here. Subtitle. OK, so we're going to have, like, the text of the tweet right here and then actually know the date here and then the text here. So that makes seems that also, we're gonna change the caller Dark gray and their grades. Well, for this one, let's do a few changes. So back here, So, actually, we're going to display the dates. So here, actually, we're gonna display the date, so that's gonna be tweaked dates, and then here it's gonna be detailed text label, and that's gonna be called to twits text. So we're gonna read the text of the tweets actually underneath. So let's try that Changes to do here. Oh, yeah, they're like optionals for all of them. Hair goes, and now you can read the tweets so we're gonna do next is allowed to configure a little bit differently. So, um, while at first, so we had originally saved the first tweet, So without reminding this one, but we know that for the next one it's gonna be just fine. We could also remove the time. You know, it's not absolutely required. And also, we're gonna make, like, the Rose larger. I'm gonna also, um, date here and allowed to have, like, a different, um text for a month. So that's gonna be larger and also gray as well. And we're gonna also allowed to display a tower. So that's maybe our photo euro that we're gonna display here. So we're gonna do that next to complete this twitter and tutorial. 8. Text Format & Row Height: So we're gonna do a few changes. Um, first of all, we're gonna go to the storyboards and select this prototype cell. We're gonna change the size of the height of this one. I'm gonna make the row heights equal to, I believe 120. Yeah, 100 twenty's fine. Also, what I'm gonna do is allowed to format the text for these. Um, take zero right here. So, actually, we can do it from here by selecting this one. Go to attributes, inspector, And I'm gonna make this when you call to 18 and Dark Gray and we're going to select. So the phone saw its regular system. We're going to select some. Yeah, we're gonna do it that way. So we're doing a few changes. Just a few adjustments before we complete with displaying the avatar right here. Here. Now we have, like, a larger view of the twits. Let's look at here. So when we start typing, so it's also ah, larger. Okay, so that was a small video. Just a short video to make a few adjustments. So what I wanted you next is to be able to actually see the Abbott over the current user So we're gonna do that next, so there's gonna be different steps of first. We're gonna need to make sure that we've got the info using for you. Remember that, too. Repressing this one from the logging view controller to the table view controller. So as soon as we say quit from here to here, we're going to pass this also, this user information. So when we say queer from here to here, we're going to do that. And then, um, display the image, the euro for the euro off the current user. So let's do that next. 9. Displaying User's Avatar: So, in order to display the avatar of the current user, we're gonna need to have a reference to the current use information first. So we've got this Segway, which is right twits. And basically, we're gonna need to just passed this information right here. That corresponds to a dictionary. We're gonna have, like, the same available. So on that you controller sweet of you, controller. So I'm gonna pose, so I'm gonna pace this one right here and back in tweets table View Control. So we're gonna use this function, which is so I'm just gonna cut all of that. But I'm just gonna cut all of that because we're never gonna use any delegate methods. So this is automatically provided each time. That's a career in your class, which is a step class off table view controller, your white table view controller. So we're just gonna use the navigation and basically said we want to make a reference of first check which sig weight is. So that's what you write twits. So it's gonna be if say, quit. I didn't fire. Is it cool to write to twit? So what we want is then get a reference to the destination view controller, which is tweets. So where we can put the twit. So that's gonna be destination? No, my best. So that's where the Segway first and then destination this destination, like so as twit you controller and then tweets view controller using full because we've just added it. Chocolate may contrive this one because otherwise doesn't understand tweet you controller using So it's gonna be equal to the using full that we have available on. That's if you as well use painful. OK, so we're going to start with that and then make sure that we pass the corresponding info for the current user. Next, we're going to tweet view controller now, and we're going to need your Russians to that, um, I'm going to use the assistant editor, you know, Did you have, like, side by side? So the main story board and the tweet view controller, because we're gonna need to then connect this one, too. Our controller are a class. So let's with this one. Actually, next to where you are, Barberton items so and also next to the outlets. And this one is gonna be avatar. But I call it other tar item of type you I Barberton item and basically so we're gonna have like, um this, um this Barberton item that we're gonna add to, um as the left Barberton items we're gonna add this one's to have a navigation bar. So first, we're gonna contribute this one. So we're gonna begin with vets because we're gonna need to actually dealt with this one, because what we get So whenever we get the user and food, it is actually a euro, which is up type euro. So we're gonna need to download. We're gonna need to do an http request in order to download this image. Let's go back, Teoh Tweet to view controller. We're gonna do that automatically add a tweet button in able to it button, and then right here, we're gonna put drunk at a little download, and that's her. Okay. And this function, we're gonna use it to return on object off type ey views. We're going to return and objects as a result of damaging this one. So that's maybe our image. You you're in a June. Then we're gonna initialize this one. Okay, so then we're gonna nation eyes, this one, actually, from here, it's gonna be reframed, See? Directs, maybe zero for the first values and then 30 by 30 cents to be quite small, because it missed two fits, like on the left side in the navigation bar. And then we're gonna also specify So the consent mode, that's what makes you and then contents let me close this wound in its two promises. So image your than content mood, and this one is gonna be skill aspect tips that's gonna think like it's going to respect the aspect ratio. It's not gonna be distorted. So then we're gonna gets, like, thankful for the other term. And we're gonna get that from the using food because we've got this euro that we save. So each time that you connect, actually, So let's go back to log in view controller, remember that we're using this dictionary right here. So we saved the display name and also value for the avatar key that corresponds to the foot of euro off the user. Okay, so that's where we're making a reference to using full and then the key. So the value that corresponds to the Kyoto and we need to confirm this one because this is not optional, okay? And finally, we're going to return the image you. So that's so that's not gonna be sufficient here. Because here, winning to actually download, um, an image like a euro image. So that's not gonna be sufficient for me to just do something like image you and then image and then create something like you are image Then you named and then, like, gets out or it's not gonna work. We're gonna need tracking you down on this one from the Internets because if we actually print this one just to begin with, it's gonna be about, or you're going to see that this is gonna be a year old string. So we're gonna need to June. It's stupid requests with that euro on basically. So we're gonna Then, uh, let me make another thing here because we're gonna need to then refer to the left Barberton item for the number. So we're gonna go back to assistant editor main storyboard, and I'm gonna need to then make a reference student that far this time. So we're gonna do that right here of itself, actually. So that's like the bar them controlling them. I'm gonna call this one that for a year ago. So then, in Judah Loew, let's go back to view controller and you did load. It's going to be right here. It's gonna be enough Burn. And then we're gonna refer to took Bytom finally left Barberton items because gonna have several. So that's the items. And then, um zero, maybe just one. So like like the first had the first index. So right here we're gonna create a new Barberton. So objects Barberton. So that's gonna be Avatar Roberton item then that creates from this. So you are Barberton item and it's gonna be like custom custom view. And then we're gonna use, like, this download, function, download and add Evita. So that's going to return this object off type you image you that we're gonna use to then create and you avatar Barberton item and then we're gonna sign these two avatar Barberton item. So we're gonna run that for now. But you're going to see that it's not gonna work just as expected, because as I was explaining, So this is a euro, so we're gonna be able to print this one, but we're going to require it's going to require another step, which is gonna be to do an edge to be a request to finally display the image. So let's go to the exactly. Nothing is happening here. So for now. And if we go in a console, we should be able to find the euro that corresponds to the foot of your URL value for our using food. Let's go all the way to the bottom. There's a lot of things mixed up all together, so that's pretty challenging to find the right comments. So if I do an HD GP here ago So this is this one, so that corresponds to, and that is an optional. So I got to make sure that this is not wrapped in an optional. So that's got response to have that are your own. So what we're gonna do next is doing a query. Director Lee down with this avatar from the Internet and then dis plates in you off this General Avatar image. So we're gonna do that, actually, right here, I'm gonna have another function, and this one is going to be used to then, um, get a euro. So that's gonna be download Donald Image, Euro. So we're gonna pass here an image, string object, so object of type string, and then we're gonna return an object in return. And this one is gonna be a type data. And as data, actually, we're gonna have returned this peasant image. That's gonna be way more simple. Image in the trunk avoids, and we're gonna get So we're gonna create a neural and we're gonna create a euro objects from this string. So that's in a bureau and then with the classy role with the string. So we're gonna create an object off type year old. That's gonna be I am just trained. Then we're gonna create a tusk that's gonna be from your old session, then shared did a task with your own. So we're going to get data response and error. If there's any back from this request, that's gonna be Euro. Maybe data have been response with an error. If there's any, then inside, we're going to check if inside we have, like any air, gonna check that first any. There's no error. So we're good to go. We're going to check. The date I return is the valley. I'm gonna do data okay equal to data And finally, I'm gonna create an image from this. If this is I've got a type of here. It looks like I don't have, like, the rights in Texas when you see image, drink and then completion. And I'm using a colon here. Okay, We're good. Okay, so then I'm gonna create an image. So that's gonna be image of a told that I'm gonna create here on the fly with your image and with data, and that's gonna be with some this data. Okay, this is OK, okay. And finally, we're going to return. So this image of the torso, once we get so once we have downloaded So with this request, and then we can invest this. So then we're going to return this as an object of value. I image and with all of that. So first we're gonna do do catch also because we don't know if we get any error in the process. So that's maybe do so here. We're gonna do you do and catch if there's any air, and we're gonna do that with by printing just for debugging purposes with error and then localize description, and also because this is something that we do that we download from the Internet, we're gonna need to force and do that. So on them in queues that's gonna be with Dispatch Cube Main than a sink executes, and then we're gonna force to execute all of that on the menu. So here we've got the Jew block. It is to block here with God's. And if let's here have another. If you repent the tusk and right underneath, we're gonna be able to then task a resume, okay? And we're done with this part. So basically, we're gonna then download the euro from here. So instead of just printing so the event or so we're gonna then that do call this function , which is download image rural, and then we're gonna past avatar. Hasn't arguments break here, and then we're going to return an image as a result of this function that we run and it's gonna be then image you image, which is gonna be equal to them. I'm gonna name this one of its our image. It's gonna be equal to avatar image. So now we know that we're gonna be able to then down those of the avatar image using the euro that we get from the using will then return an object of type image that we're going to sign to the party image of the image. You finally returned this image you And when we call this function which is here at this level right here. So we creates an avatar by Britain, Item with a custom view. So we call this functions to return and then creates you are Barberton item with a custom you which is of type you y image. And finally, real science of this avatar Barberton items too the left Barberton item off the nipple. So let's try that again. Okay, so let's see, looking with reader, then let's try. So we should be able to see not doesn't look like we can actually see. I have a term. So we're gonna add a break point just to see we're gonna actually result this one. So in the next dumb video, because I'm gonna use the break points to see, like how it is executed. So we're gonna control how this executed to see where it's going wrong. So let's see that in the next video 10. AppTransport InfoPflist: So I'm gonna out of your break points just to see, like, what we get in return here to make sure that's there is not one step where were felling. So we're gonna go to, um, my hair is, so that's going to stop here. So that's chick. That's inspect. So first, um, actually, so download of our terror. Resentful. Okay, so this is the avatar. So this is actually the Rome that were using Teoh, which is an http. So that maybe the reason on I'm thinking that it is not clearly specified here, but we may need to do something to update our infirmities because this particle is not using any secured particle using Http s, for example. So what I'm gonna do, I'm gonna go to inform police and allow arbitrary loads. So I'm gonna add an extra perimeter that's gonna be with up transport, security setting, which is a dictionary. Been inside this dictionary, we're gonna add one that's gonna default, allow arbitrary loads, and we're gonna set this 12 Yes, because looks like this is not allowing us to download anything from the Internet for now because I don't see any other mistake. So Let's try that. So now that we've got this, which is, we have removed the restriction. So we have removed the restrictions from the transport security settings, allowing so any actually to be request from any political. So let's try that. So we're going to remove the break point this time and Harry goes and that we can see the Avatar. So that was the reason when I need to update the info police to allow so to allow. So any http request from the Internet. So now we can see our have it are yellow word. It's sweeter. Let's do that. And Twitter checkouts my tweeter I was clone. I should actually put I waste were club that should tweet that right away and then display . It's 11. Debbuging: it looks like we've got, like, many things to adjust. The first of all, we're gonna need your just so, like the line. So the number of lines, um, allowed so it can fit silver lines in one twits and also looks like this is displaying so more than we have actually in our database if we check out the data bees if we check out with heavy so we actually have only three So we're gonna need some clean up. We're going to do some clean up in order to allow this to actually display. So the rial amount of twits that we have So first of all, what it like is to allow to query, do the query for the database. So Onley in viewed it appear so every time that it appears we're gonna do in your query, am I gonna do super viewed it up here, animated. And then we're gonna then call this function, and then we're gonna call this function. We're gonna cut it from here from you did load and peace to drink here. The other thing we're gonna do. So we're gonna go to Maine. Storyboard is allowed to fit several lines So we're gonna go select the subtitle, and here you're going to send this 1 to 0. Okay. And we're gonna make this one actually smaller before the date we don't eat. We don't need this one to be as big. So I'm gonna also reduce, So she's gonna be, like, 13 is fine. Yeah. We're gonna keep the 13 on here. It's gonna be 12. OK, let's try that. We can always adjust afterwards if this is, like, too small, anyway. Okay. So we could have just like, you know, it's really something that you can like and there we can read. So, like, the new Twitter twits hello? To to check out my always Twitter clone. Okay, so let's try another one. Hello again and then twit. And here ago so you could see that it was like, um, updated in real time. So it took, like, a few seconds to update, so you could even delay If you'd like the time body text to go from the like, the tweets right here, and then go back here. You could delay it so it doesn't like conflict anyway, so that is the end of this material. So I hope that this was enjoyable for you and that you could learn a lot from it. So I hope that this was enjoyable for you in that you could learn a lot from it. So if you have any questions to please you the forum, the dashboard to ask your questions, I'll be glad to assist you for any questions that you may have in regards to this Twitter clone applications tutorial.