This segment of code worked perfectly in Swift 2
override func prepare(for segue: UIStoryboardSegue?, sender: Any?) {
if (segue!.identifier == "FeedDetailSeg") {
let viewController:ItemDetail = segue!.destination as! ItemDetail
viewController.DetailItem = collectionItems![self.selectedRow]
if self.cognitoID == collectionItems![self.selectedRow].seller {
viewController.owned = true
}
else {
viewController.owned = false
}
//remove item from untapped
//appDelegate.untapped.removeAtIndex(self.selectedRow)
//collect view info
self.dataStash(collectionItems![self.selectedRow].ID, itemCondition: 2).continueWithBlock({
(task: BFTask!) -> BFTask! in
if (task.error != nil) {
print(task.error!.description)
} else {
print("DynamoDB save succeeded")
}
return nil;
})
}
}
Now in Swift 3 I get an error on line
//collect view info
self.dataStash(collectionItems![self.selectedRow].ID, itemCondition: 2).continueWithBlock({
that says: Cannot convert value of type '(BFTask<_>!) -> BFTask!' to expected argument type '(BFTask?) -> Any?!'
This is using AWS to save an item to DynamoDB.
Change the return type to
Any?
instead ofBFTask?
like this,Thanks:)