塞納里奧帶CoreData的Objective-C + Swift - 無法指定'EntityName'的值類型來鍵入'EntityName!'
我的工作,我合併斯威夫特3成Objective-C的項目一期工程。該項目正在使用CoreData和我Objective-C AppDelegate
我聲明我的「EntityName」類型,並試圖在我的Swift 3類中分配,並且出現構建錯誤「無法指定'EntityName'的類型以鍵入'EntityName! 「」。
CODE
AppDelegate.h
// Declaration
@property (strong, nonatomic) EntityName * entity;
夫特類
// Array Property
var entityList = [EntityName]()
...
// Assignment
let appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.entity = self.entityList[indexPath.row] // throws error
ERROR
can not assign type of 'EntityName' to type 'EntityName!'
WHAT我試圖
1)
appDelegate.entity = self.entityList[indexPath.row] as EntityName! // throws error
ERROR
can not assign type of 'EntityName!' to type 'EntityName!'
2)
appDelegate.entity = self.entityList[indexPath.row] as EntityName? // throws error
錯誤
can not assign type of 'EntityName?' to type 'EntityName!'
問題
如何糾正這一點,我的日子過呢?