I am using Swift on Xcode 6 with CoreData .
I read the release notes and saw this problem about marking the main data model with the module name (application name) so that you can cast the NSManagedObject type to the model type at runtime.
When I do this, I can get the application to work correctly (good!). However, my problem is that when I try to execute the test with the same code, the test will always fail every time a Swift dynamic cast failed (bad :() error occurs. This makes testing my application difficult.
Is there any effect on the name of the module that we use when the application is created for testing or is running?
Thanks in advance for any pointers ...
Following actions:
This is not ideal: As stated above, for Swift to use the Core Data model, you need to decorate the class name with the name of your application. This works to create the application, but tests run under a different application name! This means that you need to enter the data data model and change this class name from myAppname.myEntity to myAppnameTests.myEntity before you can use these objects by name when using or calling from a test.
ios swift core-data
Daniel D
source share