Array types are now written with parentheses around the element type


Here's my code (TaskManager.swift):

import UIKit

var taskMgr: TaskManager = TaskManager ()

struct task {
    var name = "untitled"
    var desc = "none"

class TaskManager: NSObject {
    var tasks = task[]()

    func addTask (name: String, desc: String) {
        tasks.append (task (name: name, desc: desc))

then I got this

/Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/TaskManager.swift:11:21: Array types are now written with the brackets around the element type

It says

Fix-it: Insert "["

I clicked it, then that line (line 11) turned to this:

var tasks = [task[]()

and I got these errors

/Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/TaskManager.swift:11:26: Expected ']' in container literal expression /Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/TaskManager.swift:11:26: Expected ',' separator /Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/TaskManager.swift:13:5: Expected expression in container literal /Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/TaskManager.swift:14:15: Cannot invoke 'append' with an argument list of type '(task)'

Thanks for any advices!

and here is another 2 errors in FirstViewController.swift:

/Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/FirstViewController.swift:21:14: 'text' is unavailable: APIs deprecated as of iOS 7 and earlier are unavailable in Swift /Users/David/Documents/360Drive/Xcode/Try/RandomTries/ToDoList/ToDoList/FirstViewController.swift:22:30: Cannot assign to 'detailTextLabel' in 'cell'

and here's the code

import UIKit

class FirstViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    override func viewDidLoad() {
        // Do any additional setup after loading the view, typically from a nib.

    override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return taskMgr.tasks.count

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell: UITableViewCell = UITableViewCell (style: UITableViewCellStyle.Subtitle, reuseIdentifier: "Default")
        cell.textLabel = ""
        cell.detailTextLabel = ""
        //cell.text = taskMgr.tasks[indexPath.row].name
        //cell.detailTextLabel = taskMgr.tasks[indexPath.row].desc
        return cell


It looks like Fix-it blew it. Swift uses brackets around the type. The correct version is this:

var tasks = [task]()

This is the shorthand notation; there is a longer version:

var tasks = Array<task>()

but the shorthand version is preferred.