百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

motion-xray

> 编程语言
开源

一个在应用程序内运行的 iOS 监视器,让您可以在真实环境中从设备上进行调试和分析。

552 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

一个在应用程序内运行的 iOS 监视器,让您可以在真实环境中从设备上进行调试和分析。

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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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