# Twitty :bird:
Step by step description of how to build a twitter clone. To begin download [starter project](https://github.com/codepath/twitter_ios_starter/raw/master/twitter_ios_starter.zip)
## GUI part
### 1. Set up a *TweetsViewController*
- Make sure to have all the connections lined up.
### 2. Set up a *tableView* on the TweetsViewController
- Setup the connections for tableView.
- Inherit the **UITableViewDelegate** and **UITableViewDataSource** to **TweetsViewController** (where tableView is setup as an outlet)
- When inheriting, click on the **fix** to implement *numberOfRowsInSection* and *CellForRowAt* functions
- set delegate and dataSource for tableView to self (which is **TweetsViewController**)
```Swift
tableView.delegate = self
tableView.dataSource = self
```
- Create a new *TweetCell* cocoa touch class
- set the table view cell identity to *Tweet Cell*
### 3 Add 1 UIImage, and 2 UILabel (for Username and Tweet)
- Set up the UIImage and UILabel outlets as properties onto the TweetCell Class
## Application
### Signning in
- In the Login view controller
```Swift
let requestToken = "https://api.twitter.com/oauth/request_token"
TwitterAPICaller.client?.login(url: requestToken, success: {
self.performSegue(withIdentifier: "LoginSegue", sender: nil)
UserDefaults.standard.set(true, forKey: "loggedIn")
print("Logged IN")
}, failure: { (Error) in
print("Error Loggin in")
})
```
### Signning Out
```Swift
TwitterAPICaller.client?.logout()
dismiss(animated: true) {
print("Logged OUt")
}
UserDefaults.standard.set(false, forKey: "loggedIn")
```