Weaver is a remote debugging tool for Texture apps. It is a client library and gateway server combination that uses Chrome DevTools on your browser to debug your application's layout hierarchy.
Demo video: https://youtu.be/zdACP6dQlQ8
Weaver is a hard fork of PonyDebugger. It was trimmed down and modified to work with layout elements from both UIKit and Texture.
To use Weaver, you must enable the client in your iOS application and connect it to the gateway server called "ponyd".
- Prerequisites: Python 2, pip, virtualenv
- Create a temporary directory:
$ mkdir ponyd && cd ponyd
- Download required dependencies
$ curl -O https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz && \
curl -O https://pypi.python.org/packages/25/5d/cc55d39ac39383dd6e04ae80501b9af3cc455be64740ad68a4e12ec81b00/setuptools-0.6c11-py2.7.egg && \
curl -O https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz && \
tar xvf pybonjour-1.1.1.tar.gz && \
mv pybonjour-1.1.1 pybonjour
- 2.1. If you're on Ubuntu, you need to install
libavahi-compat-libdnssd1
as well:
$ sudo apt-get install libavahi-compat-libdnssd1
- Download and run ponyd's boostrap script:
$ curl -s https://raw.githubusercontent.com/TextureGroup/Weaver/master/scripts/bootstrap-ponyd.py | python - --never-download ~/Library/Weaver
- Install dependencies
$ ~/Library/Weaver/bin/easy_install -U backports_abc && \
~/Library/Weaver/bin/easy_install -U certifi && \
~/Library/Weaver/bin/easy_install -U singledispatch && \
~/Library/Weaver/bin/easy_install -U pybonjour
- Add
ponyd
symlink
$ sudo mkdir -p /usr/local/bin
$ ln -s ~/Library/Weaver/bin/ponyd /usr/local/bin/ponyd
- Install DevTools
$ ponyd update-devtools
- Start the ponyd server
$ ponyd serve -i 0.0.0.0 -p 9229
In your browser, navigate to http://localhost:9229
. You should see the
ponyd lobby. Now you need to integrate the client to your application.
For more detailed instructions, check out the gateway server README_ponyd.
The Weaver iOS client lets you to debug your application's layout hierarchy.
- Requires iOS 8.0 or above
- Uses ARC (Automatic Reference Counting).
- Uses SocketRocket as a WebSocket client.
Weaver is available on CocoaPods. Add the following to your Podfile:
target 'MyApp' do
pod 'Texture'
pod 'Weaver'
end
Quit Xcode completely before running the following command in the project directory
$ pod install
in the project directory in Terminal.
To update your version of Weaver, run the following command in the project directory
$ pod update Weaver
Don't forget to use the workspace .xcworkspace
file, not the project .xcodeproj
file.
Weaver's main entry points exist in the WVDebugger
singleton.
WVDebugger *debugger = [WVDebugger defaultInstance];
Then enable layout debugging by calling enableLayoutElementDebuggingWithApplication
and passing your UIApplication to it:
[debugger enableLayoutElementDebuggingWithApplication:application];
To connect automatically to ponyd on your LAN (via Bonjour):
[debugger autoConnect];
Or to open the connection to a specific host, for instance
ws://localhost:9229/device
:
[debugger connectToURL:[NSURL URLWithString:@"ws://localhost:9229/device"]];
To manually close the connection:
[debugger disconnect];
You can find an example on how to integrate Weaver into an existing app here.
We use Slack for real-time debugging, community updates, and general talk about Texture and Weaver. Signup yourself and join #weaver channel.
We welcome any contributions. See the CONTRIBUTING file for how to get involved.
The Weaver project was created by Pinterest as a continuation, under a different name, of the PonyDebugger codebase originally developed by Square. PonyDebugger was originally released by Square under the Apache License, Version 2.0. All code contributed to Weaver after 5/15/2017 is released by Pinterest under the same license, Apache 2.0 license (http://www.apache.org/licenses/LICENSE-2.0.html).