Skip to content

Instantly share code, notes, and snippets.

@Morbix
Created December 13, 2016 22:37
Show Gist options
  • Save Morbix/41a2b835f05ea79407a88ce1b18ff76d to your computer and use it in GitHub Desktop.
Save Morbix/41a2b835f05ea79407a88ce1b18ff76d to your computer and use it in GitHub Desktop.
[iOS] Call Swift function inside Objective-C class
1. Add #import "MyFirstProjectOnSwift-Swift.h" in "MyObjectiveCLass.m"
2. Add @class mySwiftClass in MyObjectiveCLass.h;
3. Then in MyObjectiveCLass.m
mySwiftClass *myClass = [mySwiftClass new]; {Call Like This in any method wherever you want to call swift method.}
4. [myClass methodName];
Source: http://stackoverflow.com/questions/24078043/call-swift-function-from-objective-c-class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment