Search code examples
iosswiftswift2prefixxcode7-beta6

Does prefix works correctly in Xcode 7 beta 6?


I'm trying to add prefix file to my Swift project, that use CoreData. My steps:

  1. Create MySwiftProject-Prefix.pch;
  2. Add header to my .pch file (#import <CoreData/CoreData.h>);
  3. In Build Settings of my Target set Precompile Prefix Header to Yes and Prefix Header to MySwiftProject/MySwiftProject-Prefix.pch;
  4. Clean and build project.

And now i get some errors like you need import CoreData. But why? Where did i wrong?
Thanks.


Solution

  • If this is a Swift project, it doesn't use a .pch file. That's for Objective-C. Simply put import CoreData at the top of your Swift file(s).