title: swift reload data automatically
body: <p>Hi I am trying to figure out how to make it so that all my data for my timeline can reload on its own. Here is my current code for the whole TimeLineViewController</p>
  
  <pre><code>import UIKit
  import CoreData
  
  class TimelineTableViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextFieldDelegate, UIAlertViewDelegate {
  
  var timelineData:NSMutableArray! = NSMutableArray()
  
  override init(style: UITableViewStyle) {
      super.init(style: style)
      // Custom initialization
  }
  @IBAction func reportButton(sender: AnyObject) {
      performSegueWithIdentifier("reportSegue", sender: self)
  }
  
  @IBAction func composeStatus(sender: AnyObject) {
      performSegueWithIdentifier("composeSegue", sender:self)
  }
  
  @IBAction func logout(sender: AnyObject) {
      PFUser.logOut()
      var currentUser = PFUser.currentUser() // this will now be nil
          performSegueWithIdentifier("logoutSegue", sender:self)
      }
  
  required init(coder aDecoder: NSCoder) {
      super.init(coder: aDecoder)
  }
  
  func loadData(){
  
      timelineData.removeAllObjects()
  
      var findTimelineData:PFQuery = PFQuery(className: "woofs")
  
      findTimelineData.findObjectsInBackgroundWithBlock{
          (objects:[AnyObject]!, error:NSError!)-&gt;Void in
          if error == nil{
              for object in objects{
                  let woofs:PFObject = object as PFObject
                  self.timelineData.addObject(woofs)
              }
  
              let array:NSArray = self.timelineData.reverseObjectEnumerator().allObjects
              self.timelineData = NSMutableArray(array: array)
  
              self.tableView.reloadData()
          }
      }
  }
  
  override func viewDidAppear(animated: Bool) {
      self.loadData()
  }
  
  func refresh(sender:AnyObject)
  {
      // Updating your data here...
      self.tableView.reloadData()
      self.refreshControl?.endRefreshing()
  }
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      var statusBarHidden: Bool
  
      /*var newFeatureAlert:UIAlertController = UIAlertController(title: "Attention", message: "New feature added. You can now Report content that you find offensive. Just tap on Report to get the instructions on how to.", preferredStyle: UIAlertControllerStyle.Alert)
  
      newFeatureAlert.addAction(UIAlertAction(title: "AWESOME!", style: UIAlertActionStyle.Default, handler: nil))
      self.presentViewController(newFeatureAlert, animated: true, completion: nil)*/
  
      self.refreshControl?.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
  
      UITextView.appearance().tintColor = UIColor.blackColor().colorWithAlphaComponent(1.0)
      UITextView.appearance().backgroundColor = UIColor.clearColor().colorWithAlphaComponent(0.4)
      self.tableView.backgroundView = UIImageView(image: UIImage(named: "hdwallpaper"))
      }
  
  override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int {
      // #warning Potentially incomplete method implementation.
      // Return the number of sections.
      return 1
  }
  
  override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
      // #warning Incomplete method implementation.
      // Return the number of rows in the section.
      return timelineData.count
  }
  
  override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -&gt; UITableViewCell {
      let cell:PAHTableViewCell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as PAHTableViewCell
  
      cell.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3)
  
      let woofers:PFObject = self.timelineData.objectAtIndex(indexPath.row) as PFObject
  
      cell.pahTextView.alpha = 0
  
      cell.timestampLabel.alpha = 0
  
      cell.usernameLabel.alpha = 0
  
      cell.pahTextView.text = woofers.objectForKey("content") as String
  
      var dataFormatter:NSDateFormatter = NSDateFormatter()
  
      dataFormatter.dateFormat = "dd-MM-yyyy HH:mm"
  
      cell.timestampLabel.text = dataFormatter.stringFromDate(woofers.createdAt)
  
      var findwoofers:PFQuery = PFUser.query()
  
      findwoofers.whereKey("objectId", equalTo: woofers.objectForKey("woofers").objectId)
  
      findwoofers.findObjectsInBackgroundWithBlock{
  
          (objects:[AnyObject]!, error:NSError!)-&gt;Void in if error == nil{
  
              if let user:PFUser = (objects as NSArray).lastObject as? PFUser{
  
                  cell.usernameLabel.text = user.username
                  cell.timestampLabel.alpha = 0
                  cell.profileImageView.alpha = 0
                  cell.pahTextView.alpha = 0
  
                  if let profileImage = user["profileImage"] as? PFFile{
  
                      profileImage.getDataInBackgroundWithBlock {
                      (imageData: NSData!, error: NSError!) -&gt; Void in
                      if error == nil {
                          let image = UIImage(data:imageData)
                          cell.profileImageView.image = image
                      }else{
                          let image = UIImage(named: "BLUEPAW")
                          }
                      }
                  }
              }
          }
          UIView.animateWithDuration(1.0, animations:{
              cell.profileImageView.alpha = 1
              cell.usernameLabel.alpha = 2
              cell.timestampLabel.alpha = 4
              cell.pahTextView.alpha = 3
          })
      }
      return cell
  }
  </code></pre>
  
  <p>let me know what I need to change to make this work. Thank You.</p>