Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

motion-xray

> 编程语言
Open source

An iOS Inspector that runs inside your app, so you can debug and analyze from your device in real-world situations.

552 stars0 likes3 views
WebsiteGitHub

About

An iOS Inspector that runs inside your app, so you can debug and analyze from your device in real-world situations.

Motion-Xray

Developer tools for iOS. Runs on the device, no browser or computer needed.

(think Firebug or Webkit Developer Tools)

TL;DR

  1. gem install motion-xray
  2. Replace UIWindow with Motion::Xray::XrayWindow

And if you want the email features, add `app.frameworks editor class } } end end


If you inherit from a view and you want to *disable* one of the editors, assign
`nil` as the editor for that property.  `UIWindow` does this to prevent editing
`frame`, `hidden`, and `userInteractionEnabled` properties from getting changed.

```ruby
class  {
        frame: nil,
        hidden: nil,
        userInteractionEnabled: nil,
      },
    }
  end
end

…

ruby
   Motion::Xray.registerPlugin(Motion::Xray::SaveUIPlugin.new)  # use teacup
   Motion::Xray.registerPlugin(Motion::Xray::SaveUIPlugin.new(:pixate))
  1. Register custom output, by class. This will be used for any property, for instance if you want UIColor objects to be persisted as an array of RGB values, you could register that output like this:

    ruby
    register(:teacup, UIColor) { |color| "[#{color.red}, #{color.blue}, #{color.green}]" }
…

ruby Log = Motion::Xray::Log

Log.info('info!') Log.error('an error occurred!')

available methods:

Log.error, Log.warning, Log.log, Log.notice, Log.info, Log.ok, Log.debug

only log information greater than or equal to log level "warning"

Log.level = Log::Warning

…

ruby class AccessibilityPlugin < Plugin name 'Accessibility' # as you want it to appear in the toolbar

canvas is the view where the plugin will be placed. You do not need to

call addSubview on this object.

def plugin_view(canvas) return UIView.initWithFrame(canvas.bounds) end

end


So far we have:

- named our plugin 'Accessibility'
- returned an empty container

Let's add our two image views.  We'll make use of geomotion, which is required
by Xray:

```ruby
def plugin_view(canvas)
  return UIView.alloc.initWithFrame(canvas.bounds).tap do |view|
    view.backgroundColor = :black.uicolor

    @accessibility = UIButton.alloc.initWithFrame(view.bounds
      .thinner(view.bounds.width / 2))
    @colorblind = UIButton.alloc.initWithFrame(view.bounds
      .thinner(view.bounds.width / 2)
      .right(view.bounds.width / 2))

    view << @accessibility
    view << @colorblind
  end
end

When the plugin is activated, we should grab a screenshot of the app and assign it to each view. The show method is called on a plugin when it is selected.

ruby
def show
  Dispatch::Queue.main.async do
    @colorblind.setImage(get_colorblind_image, forState: :normal.uicontrolstate)
  end
  Dispatch::Queue.main.async do
    @accessibility.setImage(get_accessibility_image, forState: :normal.uicontrolstate)
  end
end

…

ruby
class AppDelegate
  def application(application, didFinishLaunchingWithOptions:launchOptions)
    @window = Motion::Xray::XrayWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
    @window.makeKeyAndVisible

    # include the SaveUIPlugin, which is not included by default
    Motion::Xray.register(Motion::Xray::SaveUIPlugin.new)

    # include a custom plugin
    Motion::Xray.register(CustomPlugin.new)

    return true
  end
end

Dependencies

Xray depends on geomotion, which I don't feel bad about, and SugarCube. I would consider removing the SugarCube dependency, because not everyone uses it, but SugarCube adds a ton of benefit (like #to_s and UIColor additions).

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言