Sha256: 952b6b86d0c75cf73ca0389af1a7f6cd9e699dc22069fc922554c6d7c60cb123

Contents?: true

Size: 455 Bytes

Versions: 1

Compression:

Stored size: 455 Bytes

Contents

module MotionBindable::Strategies

  class UITextField < ::MotionBindable::Strategy

    def on_bind
      update_attribute
      NSNotificationCenter.defaultCenter.addObserver(
        self,
        selector: :on_change,
        name: UITextFieldTextDidChangeNotification,
        object: bound
      )
    end

    def on_change
      update_attribute
    end

    private

    def update_attribute
      self.attribute = bound.text
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion_bindable-0.0.5 lib/strategies/ui_text_field.rb