I came across the following `UITableViewController` code and wanted to implement the associated `classes` and functions that go with them in order for me to learn a little bit more about Swift.

I'm not sure what the implementation of `api.getRooms()` looks like. I think it may be a closure, but I'm not entirely sure?

My question is what would `api.getRooms()` be returning considering there's `{}` usage? If anyone could explain to me what's going on that would be greatly appreciated.

```
api.getRooms(User.currentUser()!) { (roomsObj, error) in
    if let rooms = roomsObj as? Array<Room> {
        self.rooms = rooms
        self.tableView.reloadData()
        if (viaPullToRefresh) {
            self.refreshControl.endRefreshing()
        }
    }
}

```

**PullViewController.swift**

```
class PullViewController: UITableViewController {
    var rooms = Array<Room>()

    init(coder aDecoder: NSCoder!) {
        super.init(coder: aDecoder)

        // Custom initialization
        assert(User.currentUser())
    }

    override func viewDidLoad() {
        self.refreshControl = UIRefreshControl()
        self.refreshControl.addTarget(self, action: Selector("refreshInvoked"), forControlEvents: UIControlEvents.ValueChanged)
        refresh()
    }

    override func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
        return rooms.count
    }

    override func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath:NSIndexPath!) -> UITableViewCell! {
        var cell: UITableViewCell? = tableView.dequeueReusableCellWithIdentifier("Cell") as? UITableViewCell
        if !cell {
            cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier:"Cell")
        }

        let room = rooms[indexPath.row]
        cell!.textLabel.textColor = UIColor.blackColor()
        cell!.textLabel.text = "\(room.name)(\(room.messageCount))"
        return cell
    }

    func refreshInvoked() {
        refresh(viaPullToRefresh: true)
    }

    func refresh(viaPullToRefresh: Bool = false) {
        let api = API()
        api.getRooms(User.currentUser()!) { (roomsObj, error) in
            if let rooms = roomsObj as? Array<Room> {
                self.rooms = rooms
                self.tableView.reloadData()
                if (viaPullToRefresh) {
                    self.refreshControl.endRefreshing()
                }
            }
        }
    }
}

```

**User.swift**

```
class User {

    init() {
    }

    class func currentUser() -> Bool {
        return true
    }
}

```

**Room.swift**

```
class Room {

    var name: String
    var messageCount: Int

    init() {
    }
}

```

**API.swift** *(not sure whether this is implemented correctly).*

```
class API {

    init() {
    }

    func getRooms(user: User) -> (Array<Room>, String) { // ??
        // ??
    }
}

```