Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to: Ignore autogenerated "<project>-Swift.h" warnings

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


Swift code:

@objc class ... {
    internal var label: Identifier
}

Autogenerated code (both warning types):

SWIFT_CLASS("_TtC12...")
@interface ...
@property (nonatomic) Identifier * label; // warnings here
@end
like image 442
Binarian Avatar asked Aug 22 '14 16:08

Binarian


1 Answers

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.

like image 89
Andrei Papancea Avatar answered Nov 18 '22 23:11

Andrei Papancea