Swift 2.0:推断闭包类型错误

Swift 2.0 : infer closure type error

我收到错误

Unable to infer closure type in the current context

在 Swift 1.2

中运行的代码中
private lazy var _messagesVC =  { return MessagesViewController(nibName:"MessagesViewController",bundle:nil)}()

出现此错误的整个视图控制器

import UIKit
class FriendsViewController: UIViewController {

@IBOutlet weak var containerView: UIView!
@IBOutlet weak var segmentContainerView: UIView!
private lazy var _connectionVC  =  { return FriendsConnectionViewController(nibName:"FriendsConnectionViewController",bundle:nil)}()
private lazy var _messagesVC =  { return MessagesViewController(nibName:"MessagesViewController",bundle:nil)}()


override func viewDidLoad() {
    super.viewDidLoad()
    self.selectedControllerFrom(index: 0)
     // Do any additional setup after loading the view.
}

override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)

}

func selectedControllerFrom(index index:UInt)
{
    var vc:UIViewController?
    switch index{
    case 0: vc = _connectionVC
    case 1: vc = _messagesVC
    default : vc = nil
    }
    if vc != nil{
         self.showViewController(vc!,containerView: containerView);
    }
}

我找到了两种方法来消除这个错误。

首先,用它的类型明确注释 属性。我觉得这很奇怪,因为 Swift 应该只是从初始化中推断出来。

lazy var embeddedViewController: CustomViewController = CustomViewController()

第二个是删除 lazy 关键字。

var embeddedViewController = CustomViewController()

所以我猜这是目前困扰 Swift 2.0 中惰性属性的一个错误?