I'm trying to get a basic promise working with PromiseKit. However the following code wont compile:
import Foundation
import PromiseKit
class MyClass {
var myInt: Int?
func sample() -> Promise<AnyObject> {
return Promise { fulfill, reject in
fulfill(1)
}.then { data -> Int in
return 3
}
}
init() {
sample().then { data -> Void in
debugPrint("got data: \(data)")
}
}
}
This is the error I get:
command failed due to signal: segmentation fault: 11
This is pretty frustrating. Has anyone encountered this?