Based on ruby2d/mruby-frameworks
Run rake to cross compile and build the xcframework.
To update the MRuby submodule, use rake mruby_latest to set to the latest release and rake mruby_master to set the master branch.
The prebuilt xcframework is located in xcframework/.
- On project settings ->
Build Settings->Other Code Signing Flags, add--deep - On project settings ->
Signing & Capabilities->Hardened Runtime, check theDisable Library Validationoption - Copy
MRuby.xcframeworkto a folder in your project (usually a folder namedFrameworkswhere your xcodeproj is) - On target settings ->
Frameworks, Libraries, and Embedded Content, addMRuby.xcframework
- Create an new iOs Objective-C project and add the xcframework
- On
ViewController.m, add:
#include <mruby.h>
#include <mruby/compile.h>
- On
- (void)viewDidLoad)of that class, add:
mrb_state *mrb = mrb_open();
char code[] = "5.times { puts 'mruby is awesome!' }";
printf("Executing Ruby code with mruby:\n");
mrb_load_string(mrb, code);
mrb_close(mrb);
- Run and you should see 'mruby is awesome!' 5 times in the Output window.