ios - Swift Framework <-> ObjC interoperation -


i've got dylib framework uiview subclasses made in swift i've done use new @ibdesignable , @ibinspectable stuff.

so lets i've got uitextfield subclass in there named mytextfield.swift this:

mytextfield.swift

@ibdesignable class mytextfield: uitextfield {      // properties etc.     // content irrelevant    } 

now compiles , works in interfacebuilder far good. need import special subclass objective c implementation of controller set property in code @ runtime.

the framework (named myviews) has header called myviews.h able import controllers header this:

myviewcontroller.h:

@import myviews;  #import <uikit/uikit.h>  #import "myviews.h"  @interface myviewcontroller : uiviewcontroller  @property(weak, nonatomic) iboutlet mytextfield *txtname; // <-- problem!  @end 

this i'm stuck! class mytextfield unknown imported headers. myviews.h automatically generated. i've tried import bridging-headers in there without success.

myviews.h:

#import <uikit/uikit.h>  //! project version number myviews. foundation_export double myviewsversionnumber;  //! project version string myviews. foundation_export const unsigned char myviewsversionstring[];  // in header, should import public headers of framework // using statements #import <myviews/publicheader.h>  #import <myviews/mytextfield-swift.h> // <-- i've tried import here doesn't work well. 

hope may me out. in advance.

in objective-c class, try importing swift module this:

#import "<modulename>-swift.h"

where modulename name of module containing swift code


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -