Home > Software design >  Swift Cannot convert value of type '() Error [closed]
Swift Cannot convert value of type '() Error [closed]

Time:09-21

I've installed and included the BoardManager pod, I'm writing all the code watching a tutorial video. But I couldn't get rid of this error. There is no error in the video.

My Code:

   private lazy var boardManager: BLTNItemManager = {
    let item = BLTNPageItem(title: "Push Notifications")
    item.image = UIImage(named: "Bell")
    item.actionButtonTitle = "Continue"
    item.alternativeButtonTitle = "Maybe Later"
    item.descriptionText = "Would you like to stay in the loop and get notifications?"
    item.actionHandler = { _ in
        ViewController.didTapBoardContinue()
    }
    
    item.alternativeHandler = { _ in
        ViewController.didTapBoardSkip()
    }
    
    return BLTNItemManager(rootItem: item)
}

Error:

Cannot convert value of type '() -> _' to specified type 'BLTNItemManager'

CodePudding user response:

You are missing a () at the end

private lazy var boardManager: BLTNItemManager = {
   //other code you have
}()
  • Related