Provides a basic starting point for building cross-platform RubyMotion gems and applications.
This gem provides a project structure allowing you to share code across iOS, Android, and macOS platforms while maintaining platform-specific customizations where needed.
Add this line to your application's Gemfile:
gem 'motion-cross-platform'
And then execute:
$ bundle
Or install it yourself as:
$ gem install motion-cross-platform
Organize your app code into platform-specific directories:
app/
app_delegate.rb # Shared code (loaded by all platforms)
ios/ # iOS-specific code
android/ # Android-specific code
osx/ # macOS-specific code
cocoa/ # Shared iOS/macOS code (excluded from Android)
In your Rakefile, use the platform helper to define platform-specific settings:
Motion::Project::App.setup do |app|
app.name = 'MyApp'
app.platform :ios do
app.deployment_target = '12.0'
end
app.platform :android do
app.api_version = '29'
end
app.platform :osx do
app.deployment_target = '10.14'
end
endBuild and run for each platform using the namespaced rake tasks:
# iOS
rake ios # Build and run in simulator
rake ios:device # Build and run on device
rake ios:spec # Run tests in simulator
# Android
rake android # Build and run in emulator
rake android:device # Build and run on device
rake android:spec # Run tests in emulator
# macOS
rake osx # Build and run
rake osx:spec # Run testsRun iOS and Android simultaneously with a combined REPL:
rake mobile # or: rake super_replThis launches both simulators and lets you evaluate Ruby expressions on both platforms at once.
Run rake -T to see all available tasks, or rake ios -T, rake android -T, rake osx -T for platform-specific tasks.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request