3

When I try to build my app with Xcode 8 beta (after converting my Swift 2.2 to Swift 3 using the built-in tool), the automatically generated Swift header (TargetName-Swift.h) has some errors. There are 3 different errors occurring at multiple lines.

For example in this section:

SWIFT_CLASS_PROPERTY(@property (nonatomic, class, copy) NSArray<NSDictionary<NSString *, NSString *> *> * _Nonnull CANewsFilterBlacklist;)
+ (NSArray<NSDictionary<NSString *, NSString *> *> * _Nonnull)CANewsFilterBlacklist;
+ (void)setCANewsFilterBlacklist:(NSArray<NSDictionary<NSString *, NSString *> *> * _Nonnull)newValue;

Line 1:

TargetName-Swift.h:562:90: Too many arguments provided to function-like macro invocation

and

TargetName-Swift.h:562:1: Unknown type name 'SWIFT_CLASS_PROPERTY'

Line 2:

TargetName-Swift.h:563:1: Expected identifier or '('

This is the Swift-Code that belongs to the code above:

public static var CANewsFilterBlacklist:[[String:String]] {
    get {
        if let data = iCloudStorageStatic.object(forKey: CAUserDefaultsNewsFilterBlacklistKey) as? [[String:String]] {
            return data
        } else {
            return [[String:String]]()
        }
    }
    set (newValue) {
        iCloudStorageStatic.set(newValue, forKey: CAUserDefaultsNewsFilterBlacklistKey)
    }
}

I have no idea, what is wrong with my Swift-Code? Xcode does not show any errors in the Swift code. It just generates the corrupt Swift-Header.

Is this a bug in Xcode 8 (in Xcode 7, everything worked as expected)?

FelixSFD
  • 6,052
  • 10
  • 43
  • 117

2 Answers2

0

As rickster said, it was a bug in Xcode, which is resolved in Version 8.0 beta 2. https://openradar.appspot.com/26786528

FelixSFD
  • 6,052
  • 10
  • 43
  • 117
  • Any update on this.? I'm getting similar error on Xcode10. Any workaround for this issue? – Mani Feb 14 '19 at 15:39
-1

was having the same issue and noticed that the method was using objects not available in Objective-C, in your case

[[String:String]]

is swift specific, try to use NSDictionary instead and also not sure if the properties in swift can be converted to Objective-C equivalent directly by the compiler through the generated header,

if you are not using CANewsFilterBlacklist from outside declaring it as private might be also a fix,

hopefully apple will come with proper fix later

Shaz
  • 958
  • 7
  • 9