SENARIOObjective-C + Swift with CoreData - 'EntityName'の値型を 'EntityName'に割り当てることはできません。
私はObjective-Cのプロジェクトにスウィフト3をマージしていたプロジェクトに取り組んでいます。プロジェクトで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
Iは
1を試したどのようなエラー
can not assign type of 'EntityName' to type 'EntityName!'
)
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
ERROR
can not assign type of 'EntityName?' to type 'EntityName!'
QUESTION
どのように私はこれを是正し、私の一日に乗るのですか?