<commit_before>module Calabash
  module IOS
    # @!visibility private
    module UIA

      # Evaluates `script` with Apple's UIAutomation API.
      #
      def uia(script)
        Device.default.evaluate_uia(script)
      end

      def uia_with_target(script)
        uia("UIATarget.localTarget().#{script}")
      end

      def uia_with_app(script)
        uia("UIATarget.localTarget().frontMostApp().#{script}")
      end

      def uia_with_main_window(script)
        uia("UIATarget.localTarget().frontMostApp().mainWindow().#{script}")
      end<commit_msg>Docs: expose IOS::UIA public API<commit_after>module Calabash
  module IOS

    # Methods for interacting directly with Apple's UIAutomation API.
    #
    # https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html
    # https://developer.apple.com/library/ios/documentation/DeveloperTools/Reference/UIAutomationRef/
    #
    # Calabash iOS uses this API to perform gestures.  It is sometimes helpful
    # to drop down into this API to explore your app.
    module UIA

      # Evaluates `script` using Apples's UIAutomation API.
      #
      # @example
      #  uia("UIATarget.localTarget().shake()")
      #  uia("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Delete']")
      #  uia("UIATarget.localTarget().frontMostApp().mainWindow().elements()")
      def uia(script)
        Device.default.evaluate_uia(script)
      end

      # Evaluates `script` after prefixing with "UIATarget.localTarget()"
      #
      # @example
      #  uia_with_target("shake()")
      def uia_with_target(script)
        uia("UIATarget.localTarget().#{script}")
      end

      # Evaluates `script` after prefixing with
      # "UIATarget.localTarget().frontMostApp()"
      #
      # @example
      #  uia_with_app("keyboard().buttons()['Delete'])
      def uia_with_app(script)
        uia("UIATarget.localTarget().frontMostApp().#{script}")
      end

      # Evaluates `script` after prefixing with
      # "UIATarget.localTarget().frontMostApp().mainWindow()"
      def uia_with_main_window(script)
        uia("UIATarget.localTarget().frontMostApp().mainWindow().#{script}")
      end
{'fraction_non_alphanumeric': 0.12389770723104056, 'fraction_numerical': 0.0, 'mean_word_length': 3.1480804387568555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5158115', 'n_tokens_mistral': 715, 'n_tokens_neox': 697, 'n_words': 119}