class XcodeXml

Public Class Methods

check_if_file_uses_autolayout(file, doc_xpath) click to toggle source
# File lib/check_xcode_xmls/helpers.rb, line 8
def self.check_if_file_uses_autolayout(file, doc_xpath)
  # <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch"
  # propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
  if doc_xpath.attribute('useAutolayout').nil?
    return ["#{file}: doesn't use autolayout."]
  end
  nil
end
extension() click to toggle source
# File lib/check_xcode_xmls/helpers.rb, line 4
def self.extension
  'implement in subclass'
end
search_constraints_without_identifiers(file, doc_xpath) click to toggle source
# File lib/check_xcode_xmls/helpers.rb, line 17
def self.search_constraints_without_identifiers(file, doc_xpath)
  result = []
  doc_xpath.children.each do |child|
    array = search_constraints_without_identifiers(file, child)
    # puts '----'
    # puts child
    if child.name == 'constraint'
      if child.attr('identifier').nil?
        array.push("#{file}: constraint with id #{child.attr('id')} doesn't have an identifier.")
      end
    end
    result += array unless array.nil?
  end
  result
end