Swift from ObjC: Cannot resolve variable or class name, but compiles and runs fine.

In my ObjC project I have just added a swift cocoa pod framework.  I am able to use the swift classes from ObjC, compile, and run fine but AppCode is not able to resolve any of the variables or classes that are from the swift framework. I can't jump to definition, etc...  For my ObjC classes being used in the same file, I have no problem.

This is the first time I'm using swift, and I'm not actually really using it just using a lib that happens  to be written in swift, so I'm not sure if I've done something wrong, but it seems suggestive that compiling and running works fine?

1
2 comments
Avatar
Permanently deleted user

Hi David.

This is due to the following issue: OC-12322. It should be available in one of the EAP builds for AppCode 2016.1.x version. Please watch the ticket to get the update notification.

0
Avatar
Permanently deleted user
This has significantly improved in 2016.1.3, however there are still issues, some of which are new.

Specifically, while my project compiles fine, I still get the following red underlines/issues:
  • #import of a header that eventually leads to a Swift framework @import underlined. And header with that @import recognizes none of the imported swift classes (altho the implementation does)
  • Swift enums when assigned are marked red/not found "Cannot resolve variable"
  • "Incompatible types 'String*' and 'NSString* warning/yellow highlight

For the following, it looks like AppCode mistakenly thinks primitive types are pointer types
  • "Types 'Double*' and 'double' not compatible" for assignments to double values.
  • "Types 'CGFloat*' and 'CGFloat' not compatible" for assignment to CGFloat values.
  • "taking a pointer from integer with out a cast" warning/yellow highlight
0

Please sign in to leave a comment.