Parse Issue / Expected type for CGFloat in Swift

I have added XLForm , an Objective C library, to my Swift project using Xcode 6 beta 6.

The compiler disables the prototype of the protocol definition method in XLFormDescriptorCell.h

#import <Foundation/Foundation.h>
...
@protocol XLFormDescriptorCell <NSObject>
...
@optional
+(CGFloat)formDescriptorCellHeightForRowDescriptor:(XLFormRowDescriptor *)rowDescriptor;
  ^
  Parse Issue / Expected a type

      

Additional warning: "Semantic problem: conflicting return type in implementation of" forDescriptorCellHeightForRowDescriptor ":" id "vs" CGFloat "(aka 'float')

In my project Bridging-Header.h file I added (although the parsing error occurs whether I add this or not):

#import "XLForm.h"

      

which itself includes XLFormDescriptorCell.h

I can't see where XLForm is returning "id". Does anyone come across this or something similar?

+3


source to share


1 answer


CGFloat is declared in CoreGraphics / CGBase.h, which is imported by some headers imported to UIKit / UIKit.h, which is imported by default in most of the code files Xcode creates for you, import manually if needed.



As far as return type mismatch is concerned, check the return value in your implementation, make sure it returns exactly CGFloat and not NSNumber or whatever.

+8


source







All Articles