While editing a Swift file, I am getting several:
@objc attribute used without importing module 'Foundation'
@objc can only be used with members of classes, @objc protocols, and concrete
extensions of classes
Use of unresolved identifier
Use of undeclared type
compiler errors.
For instance,
@objc func returnTrue() -> Bool { return true }
complains @objc attribute used without importing module 'Foundation'
even though my pch
file contains #import <Foundation/Foundation.h>
I have restarted Xcode/Mac; uninstalled/reinstalled Xcode; deleted derived data; changed/reverted the pch file; checked class target memberships; and cleaned the build folder (several times). I can successfully compile and run the code.
Any thoughts?