Execution was interrupted, reason: signal SIGABRT. The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.

I just run a simple test on playground of Xcode 11.3.1. But got the error:

error: Execution was interrupted, reason: signal SIGABRT.
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.

Please let me know what I am wrong? or this is a bug of Xcode?

Replies

Could you post the complete playground code as well ? That would certainly help.

class Department {

    var name: String

    var courses: [Course]

    init(name: String) {

        self.name = name

        self.courses = []

    }

}


class Course {

    var name: String

    unowned var department: Department

    unowned var nextCourse: Course?

    init(name: String, in department: Department) {

        self.name = name

        self.department = department

        self.nextCourse = nil

    }

}

let firstCourse = Course(name: "Computer", in: Department(name: "CSE"))

error: Execution was interrupted, reason: signal SIGABRT.

Problem comes from unowned attribute in

   unowned var department: Department

I replaced with

   var department: Department

And crash is gone.

What do you expect from this unowned ?