Sha256: 7f1e1647b1e90580f04aae7c672e17a7c687861456105c65dd7580c747114f66

Contents?: true

Size: 484 Bytes

Versions: 4

Compression:

Stored size: 484 Bytes

Contents

class UnderOs::UI::Switch < UnderOs::UI::Input
  wraps UISwitch, tag: 'switch'

  def initialize(options={})
    super
    self.checked = options[:checked] if options[:checked]
    @_.addTarget self, action: :handle_change, forControlEvents:UIControlEventValueChanged
  end

  def value
    @_value
  end

  def value=(value)
    @_value = value # just saving it on the instance
  end

  def checked
    @_.on?
  end

  def checked=(flag)
    @_.setOn flag, animated: true
  end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
under-os-ui-1.4.0 lib/under_os/ui/switch.rb
under-os-1.3.0 lib/under_os/ui/switch.rb
under-os-1.2.1 lib/under_os/ui/switch.rb
under-os-1.2.0 lib/under_os/ui/switch.rb