Method: RunLoop::SimControl#launch_sim

Defined in:
lib/run_loop/sim_control.rb

#launch_sim(opts = {}) ⇒ Object

TODO:

Consider migrating apple script call to xctools.

If it is not already running, launch the simulator for the current version of Xcode. Launches the simulator in the background so it does not steal focus.

Parameters:

  • opts (Hash) (defaults to: {})

    Optional controls.

Options Hash (opts):

  • :post_launch_wait (Float) — default: 2.0

    How long to sleep after the simulator has launched.



92
93
94
95
96
97
98
99
# File 'lib/run_loop/sim_control.rb', line 92

def launch_sim(opts={})
  unless sim_is_running?
    default_opts = {:post_launch_wait => RunLoop::Environment.sim_post_launch_wait || 2.0}
    merged_opts = default_opts.merge(opts)
    `xcrun open -g -a "#{sim_app_path}"`
    sleep(merged_opts[:post_launch_wait]) if merged_opts[:post_launch_wait]
  end
end