ios - How to call a swift view controller in objective c? -


i have objective c controller, want call controller swift controller objc controller?

apparently it's quite easy.

  1. you have first make sure you're prepending class declaration @objc it's available objective-c ones.

for example:

import foundation  // belongs target 'testproject' @objc class swiftcontroller: uiviewcontroller {      //... truncated  } 
  1. now have import name of target (that swift controller belongs to), appended '-swift.h'—exposing interface—like so:

    #import "testproject-swift.h"


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -