Created
December 5, 2014 02:32
-
-
Save michaeleisel/b40220147c9629d80550 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'pry-byebug' | |
if ARGV.size < 1 | |
puts "please enter the file to use" | |
exit 1 | |
end | |
storyboard = Nokogiri::XML(IO.read(ARGV[0]), &:noblanks).root | |
views = storyboard.xpath("//subviews/*") + storyboard.xpath("//view") | |
views.each do |view| | |
id = view["id"] | |
outlet = storyboard.at_xpath("//outlet[@destination='#{id}']") | |
if outlet | |
name = outlet["property"] | |
if name | |
view["userLabel"] = name if name | |
end | |
end | |
end | |
puts storyboard.to_s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment