plu / simctl

Ruby interface to xcrun simctl
http://www.rubydoc.info/gems/simctl
MIT License
104 stars 19 forks source link

Add support for taking screenshots #9

Closed stupergenius closed 7 years ago

stupergenius commented 7 years ago

As of Xcode 8.2, we can now take screenshots through the simctl tool by doing something like:

$ xcrun simctl io booted screenshot

It would be nice if the gem also provided an interface for grabbing this screenshot, with options to save to a named file, but perhaps also to grab the bytes from stdout.

I imagine a new method on the Device class would be something like:

device.screenshot(type: "png", filename: "foo.png")
plu commented 7 years ago

Change is on master:

@device.screenshot!("/tmp/screenshot.png")

# Should also support, but untested:
@device.screenshot!("/tmp/screenshot.png", type: "bmp", display: "tv")
stupergenius commented 7 years ago

Thanks! 💯