Digital ACT-191 ONEAPP-6830 story: refactored code

This commit is contained in:
vasavk 2024-03-21 21:35:14 +05:30
parent 2b0390b813
commit abbaa6ffb9

View File

@ -40,30 +40,28 @@ class CarouselScrollbarViewConttroller: BaseViewController<CarouselScrollbar> {
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.numberOfSlides = nil
return
}
self?.component.numberOfSlides = number.intValue
self?.component.position = Int(self?.positionTextField.text ?? "1")
self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
}.store(in: &subscribers)
positionTextField
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.position = nil
return
}
self?.component.position = number.intValue
}.store(in: &subscribers)
}
func setupModel() {
//setup UI
component.numberOfSlides = 8
surfacePickerSelectorView.text = component.surface.rawValue
slidesTextField.text = String(component.numberOfSlides ?? 1)
slidesTextField.text = String(component.numberOfSlides)
positionTextField.text = String(component.position)
//setup test page to show scrubber id was changed
component.onScrubberDidChange = { [weak self] scrubberId in
@ -80,7 +78,7 @@ class CarouselScrollbarViewConttroller: BaseViewController<CarouselScrollbar> {
layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.selectedLayout = item
self?.component.position = Int(self?.positionTextField.text ?? "1")
self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
}
}
}