将图像从Objective VC发送到Swift配置的VC

vai*_*hav 0 iphone objective-c viewcontroller ios swift3

我正在开发一个项目,某个地方需要ViewControler使用segue或storyboard 将编辑过的图像发送给另一个.

首先要了解一些要点.

  • ViewController我发送其使用配置的图像Objective C.
  • 并且图像将通过ViewController使用SwiftLang 配置的图像.

问题:

在Objective .m文件中导入的Swift类是不可见的,因此它允许我创建其对象以引用其成员.

我试过了:

// here i am not able to create SwiftVC class object so i can pass image further
SwfitVC *object = [self.storyboard instantiateViewControllerWithIdentifier:@"VC_Identifire"]; 
object.image = image; 
[self.navigationController pushViewController:object animated:YES];
Run Code Online (Sandbox Code Playgroud)

导入.m文件后,SwftVC类不可见.

请看看.谢谢.

Aaq*_*ain 6

为了使您的Swift文件可见; 在.m文件中,您必须编写此import语句.

#import "YourProjectName-Swift.h"
Run Code Online (Sandbox Code Playgroud)

清理并构建然后您将能够使用您的Swift类.