Sha256: 93e802531e64aba20e542193d248246bcf408b6e43041449019ed4ba570cc47e

Contents?: true

Size: 529 Bytes

Versions: 4

Compression:

Stored size: 529 Bytes

Contents

module MotionBindable::Strategies

  class UITextField < ::MotionBindable::Strategy

    def on_bind
      if bound.delegate.is_a? ::MotionBindable::DelegateProxy
        bound.delegate.delegates << self
      else
        bound.delegate = ::MotionBindable::DelegateProxy.new(
          bound.delegate,
          self
        )
      end

      update_attribute
    end

    def textFieldDidEndEditing(_)
      update_attribute
    end

    private

    def update_attribute
      self.attribute = bound.text
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
motion_bindable-0.0.4 lib/strategies/ui_text_field.rb
motion_bindable-0.0.3 lib/strategies/ui_text_field.rb
motion_bindable-0.0.2 lib/strategies/ui_text_field.rb
motion_bindable-0.0.1 lib/strategies/ui_text_field.rb