Skip to content

Instantly share code, notes, and snippets.

@michaeleisel
Created December 5, 2014 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaeleisel/b40220147c9629d80550 to your computer and use it in GitHub Desktop.
Save michaeleisel/b40220147c9629d80550 to your computer and use it in GitHub Desktop.
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