 import LoremIpsum
 import RevealableCell
 
-enum Cell: String {
-    case Left = "leftAlignedCell"
-    case Right = "rightAlignedCell"
+enum Position: String {
+    case left = "leftAlignedCell"
+    case right = "rightAlignedCell"
 }
 
 class ViewController: UITableViewController {
+
+    var messages = [Message]()
     
     func configure(cell: TableViewCell, at indexPath: IndexPath, with message: Message) {
         

    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> RevealableTableViewCell {
        let message = messages[indexPath.item]
        let cell = tableView.dequeueReusableCell(withIdentifier: message.cell.rawValue, for: indexPath as IndexPath) as! TableViewCell
        configure(cell: cell, at: indexPath, with: message)
        return cell
    }
    
    override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
        return 49
    }
    
    override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
        let message = messages[indexPath.item]
        
        if let cell = tableView.dequeueReusableCell(withIdentifier: message.cell.rawValue) as? TableViewCell {
            configure(cell: cell, at: indexPath, with: message)
            return cell.contentView.systemLayoutSizeFitting(UIView.layoutFittingExpandedSize).height
        }
        
        return 50
    }
    
    override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
        return "Today"
    }
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {

final class Message {
    
    let text: String
    let date: Date
    let position: Position
    
    init(position: Position, date: Date, text: String) {
        self.text = text
        self.position = position
        self.date = date
    }
    
}
