def animate(opts = {}, &block)

      animations_callback = (block || opts[:animations] || opts[:changes])
      before_callback = opts[:before]
      after_callback = (opts[:completion] || opts[:after])
      return self unless animations_callback

      working_selected = self.selected
      self_rmq = self

      working_selected.each do |view|
        view_rmq = self_rmq.wrap(view)

        return_var = nil

        if before_callback
          return_var = before_callback.call(view_rmq)
        end

        animations_lambda = -> do
          case animations_callback.arity
          when 0
            animations_callback.call
          when 1
            animations_callback.call(view_rmq)
          when 2
            animations_callback.call(view_rmq, return_var)
          end
        end

        after_lambda = if after_callback
          ->(did_finish) {
            # TODO, check arity and allow just view_rmq or no params. Also
            # this is backwards, should be view_rmq, did_finish
            after_callback.call(did_finish, view_rmq)
          }
        else
          nil
        end

        if accessibility.voiceover_running?
          after_lambda.call(true)
        else
          UIView.animateWithDuration(
            opts[:duration] || 0.3,
            delay: opts[:delay] || 0.0,
            options: opts[:options] || UIViewAnimationOptionCurveEaseInOut,
            animations: animations_lambda,
            completion: after_lambda
          )
        end
      end

      self
    end
def animate(opts = {}, &block)

      animations_callback = (block || opts[:animations] || opts[:changes])
      before_callback = opts[:before]
      after_callback = (opts[:completion] || opts[:after])
      return self unless animations_callback

      working_selected = self.selected
      self_rmq = self

      working_selected.each do |view|
        view_rmq = self_rmq.wrap(view)

        return_var = nil

        if before_callback
          return_var = before_callback.call(view_rmq)
        end

        animations_lambda = -> do
          case animations_callback.arity
          when 0
            animations_callback.call
          when 1
            animations_callback.call(view_rmq)
          when 2
            animations_callback.call(view_rmq, return_var)
          end
        end

        after_lambda = if after_callback
          ->(did_finish) {
            # TODO, check arity and allow just view_rmq or no params. Also
            # this is backwards, should be view_rmq, did_finish
            after_callback.call(did_finish, view_rmq)
          }
        else
          nil
        end

        if accessibility.voiceover_running?
          after_lambda.call(true)
        else
          UIView.animateWithDuration(
            opts[:duration] || 0.3,
            delay: opts[:delay] || 0.0,
            options: opts[:options] || UIViewAnimationOptionCurveEaseInOut,
            animations: animations_lambda,
            completion: after_lambda
          )
        end
      end

      self
    end
Animate

 @return [RMQ]