I created a new OSX application with Swift. Start with a view by dragging it into a table view into a view. Then I pressed Ctrl and dragged from my table view to add AppDelegate as my dataSource and delegate . Finally, ctrl-clicked and dragged from AppDelegate to create an IBOutlet for myTableView to represent the table.
Why is this happening? Using Xcode version 6.1 (6A1027).
As a result, we obtain the following results: 
import Cocoa class AppDelegate: NSObject, NSApplicationDelegate, NSTableViewDataSource, NSTableViewDelegate { @IBOutlet weak var window: NSWindow! @IBOutlet weak var myTableView: NSTableView! func applicationDidFinishLaunching(aNotification: NSNotification?) { } func numberOfRowsInTableView(aTableView: NSTableView!) -> Int { let numberOfRows:Int = getDataArray().count return numberOfRows } func tableView(tableView: NSTableView!, objectValueForTableColumn tableColumn: NSTableColumn!, row rowIndex: Int) -> AnyObject! { var newString: (AnyObject?) = getDataArray().objectAtIndex(rowIndex).objectForKey(tableColumn.identifier) println(newString!) return newString! } func applicationWillTerminate(aNotification: NSNotification?) { // Insert code here to tear down your application } func getDataArray () -> NSArray{ var dataArray:[NSDictionary] = [["FirstName": "Debasis", "LastName": "Das"], ["FirstName": "Nishant", "LastName": "Singh"], ["FirstName": "John", "LastName": "Doe"], ["FirstName": "Jane", "LastName": "Doe"], ["FirstName": "Mary", "LastName": "Jane"]]; //println(dataArray); return dataArray; } }
Steve source share