Reputation: 12446
I have a project with both, Swift and Objective-C code. I have no warnings except one file with the project name and then the suffix -Swift.h, it is the auto generated header from the Swift files.
This file is not in my project navigator nor in the folder of the project in the Finder. I can not find it in the Build Phases to add -fno-objc-arc
.
Changing the file and adding code to suppress the warning will be deleted the next time I build the app.
At the top of the file is the line
// Generated by Swift version 1.0 (swift-600.0.47.8)
How can I get rid of this warning without disabling the helpful warnings for the other files in my project?
Warning exmaples:
Default property attribute 'assign' not appropriate for non-GC object
No 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
@objc class ... {
internal var label: Identifier
}
SWIFT_CLASS("_TtC12...")
@interface ...
@property (nonatomic) Identifier * label; // warnings here
@end
Upvotes: 8
Views: 2179
Reputation: 181
This comment on the original question solved it for me. Once I converted the non-ARC Objective-C classes that were importing the generated Swift.h file to ARC the warnings went away.
I had this issue the same. It turns out that I have an old objective-c class which I set -fno-objc-arc compiler flag to and this objective-c class imports -swift.h which causes this warning very reasonably. Eventually I made the objective-c class to support ARC and the warning is gone. – Berby Huang Sep 19 '14 at 5:18
Upvotes: 1
Reputation: 2224
You need to import UIKit in the file that is throwing the error.
Swift:
import UIKit
Obj C:
#import <UIKit/UIKit.h>
Also, take a look at my previous post: How to import Swift code to Objective-C
Given the above, try to disable "Defines Module", clean your project, and re-enable "Defines Module". Hope this helps.
Upvotes: 2