example for toggle publishers (UIControl) listening for .valueChanged
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a9358c9892
commit
231fa9c486
@ -37,7 +37,11 @@ class ToggleViewController: ModelViewController<DefaultToggleModel>, StoryboardI
|
|||||||
toggle.leadingAnchor.constraint(equalTo: toggleContainerView.leadingAnchor, constant: 20).isActive = true
|
toggle.leadingAnchor.constraint(equalTo: toggleContainerView.leadingAnchor, constant: 20).isActive = true
|
||||||
toggle.bottomAnchor.constraint(equalTo: toggleContainerView.bottomAnchor, constant: -20).isActive = true
|
toggle.bottomAnchor.constraint(equalTo: toggleContainerView.bottomAnchor, constant: -20).isActive = true
|
||||||
toggle.topAnchor.constraint(equalTo: toggleContainerView.topAnchor, constant: 20).isActive = true
|
toggle.topAnchor.constraint(equalTo: toggleContainerView.topAnchor, constant: 20).isActive = true
|
||||||
|
|
||||||
|
toggle.publisher(for: .valueChanged).sink { toggle in
|
||||||
|
print("toggle changed: \(toggle.isOn)")
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
showTextStack.isHidden = true
|
showTextStack.isHidden = true
|
||||||
view.addGestureRecognizer(UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:))))
|
view.addGestureRecognizer(UITapGestureRecognizer(target: self.view, action: #selector(UIView.endEditing(_:))))
|
||||||
setupPicker()
|
setupPicker()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user