Merge branch 'vasavk/carouselScrollbar' into 'develop'
VDS Brand 3.0 Carousel Scrollbar for IOS See merge request BPHV_MIPS/vds_ios_sample!60
This commit is contained in:
commit
fae1b7788a
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; };
|
1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */; };
|
||||||
|
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; };
|
||||||
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; };
|
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; };
|
||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
|
||||||
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
|
||||||
@ -130,6 +131,7 @@
|
|||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = "<group>"; };
|
1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = "<group>"; };
|
||||||
|
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = "<group>"; };
|
||||||
445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
|
445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
|
||||||
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
|
||||||
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
|
||||||
@ -322,6 +324,9 @@
|
|||||||
EAB5FEEE2927E28400998C17 /* ButtonGroupViewController.swift */,
|
EAB5FEEE2927E28400998C17 /* ButtonGroupViewController.swift */,
|
||||||
EA81410D2A0ED8DC004F60D2 /* ButtonIconViewController.swift */,
|
EA81410D2A0ED8DC004F60D2 /* ButtonIconViewController.swift */,
|
||||||
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */,
|
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */,
|
||||||
|
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */,
|
||||||
|
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
|
||||||
|
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
|
||||||
EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */,
|
EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */,
|
||||||
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
|
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
|
||||||
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
|
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
|
||||||
@ -499,6 +504,7 @@
|
|||||||
EA89205128B68307006B9984 /* TextField.swift in Sources */,
|
EA89205128B68307006B9984 /* TextField.swift in Sources */,
|
||||||
EA297A682A02F5320031ED56 /* TableViewTestController.swift in Sources */,
|
EA297A682A02F5320031ED56 /* TableViewTestController.swift in Sources */,
|
||||||
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
|
||||||
|
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */,
|
||||||
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
|
||||||
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
|
||||||
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,
|
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,
|
||||||
|
|||||||
121
VDSSample/ViewControllers/CarouselScrollbarViewConttroller.swift
Normal file
121
VDSSample/ViewControllers/CarouselScrollbarViewConttroller.swift
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
//
|
||||||
|
// CarouselScrollbarViewConttroller.swift
|
||||||
|
// VDSSample
|
||||||
|
//
|
||||||
|
// Created by Kanamarlapudi, Vasavi on 15/03/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
import Combine
|
||||||
|
import VDSColorTokens
|
||||||
|
|
||||||
|
class CarouselScrollbarViewConttroller: BaseViewController<CarouselScrollbar> {
|
||||||
|
|
||||||
|
lazy var layoutPickerSelectorView = {
|
||||||
|
PickerSelectorView(title: "1UP",
|
||||||
|
picker: self.picker,
|
||||||
|
items: CarouselScrollbar.Layout.allCases)
|
||||||
|
}()
|
||||||
|
|
||||||
|
var slidesTextField = NumericField()
|
||||||
|
var positionTextField = NumericField()
|
||||||
|
var currentPositionLabel = Label().with { $0.textStyle = .boldBodyMedium }
|
||||||
|
|
||||||
|
override func viewDidLoad() {
|
||||||
|
super.viewDidLoad()
|
||||||
|
let stack = UIStackView(arrangedSubviews: [component, currentPositionLabel]).with {
|
||||||
|
$0.axis = .vertical
|
||||||
|
$0.spacing = 25
|
||||||
|
}
|
||||||
|
addContentTopView(view: stack)
|
||||||
|
setupPicker()
|
||||||
|
setupModel()
|
||||||
|
}
|
||||||
|
|
||||||
|
override func setupForm() {
|
||||||
|
super.setupForm()
|
||||||
|
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||||
|
addFormRow(label: "Layout", view: layoutPickerSelectorView)
|
||||||
|
addFormRow(label: "Number Of Slides", view: slidesTextField)
|
||||||
|
addFormRow(label: "Position", view: positionTextField)
|
||||||
|
|
||||||
|
slidesTextField
|
||||||
|
.numberPublisher
|
||||||
|
.sink { [weak self] number in
|
||||||
|
guard let number else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.component.numberOfSlides = number.intValue
|
||||||
|
self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
|
positionTextField
|
||||||
|
.numberPublisher
|
||||||
|
.sink { [weak self] number in
|
||||||
|
guard let number else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self?.component.position = number.intValue
|
||||||
|
}.store(in: &subscribers)
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupModel() {
|
||||||
|
//setup UI
|
||||||
|
component.numberOfSlides = 4
|
||||||
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
|
slidesTextField.text = String(component.numberOfSlides)
|
||||||
|
positionTextField.text = String(component.position)
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"")
|
||||||
|
|
||||||
|
//setup test page to show scrubber id was changed
|
||||||
|
component.onScrubberDrag = { [weak self] scrubberId in
|
||||||
|
guard let self else { return }
|
||||||
|
positionTextField.text = String(scrubberId)
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"onScrubberDrag")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// will be called when the thumb move forward.
|
||||||
|
component.onMoveForward = { [weak self] scrubberId in
|
||||||
|
guard let self else { return }
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"onMoveForward")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// will be called when the thumb move backward.
|
||||||
|
component.onMoveBackward = { [weak self] scrubberId in
|
||||||
|
guard let self else { return }
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"onMoveBackward")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// will be called when the thumb touch start.
|
||||||
|
component.onThumbTouchStart = { [weak self] scrubberId in
|
||||||
|
guard let self else { return }
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"onThumbTouchStart")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// will be called when the thumb touch end.
|
||||||
|
component.onThumbTouchEnd = { [weak self] scrubberId in
|
||||||
|
guard let self else { return }
|
||||||
|
updatedPositionLabel(position: component.position, callbackText:"onThumbTouchEnd")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func updatedPositionLabel(position: Int?, callbackText: String) {
|
||||||
|
currentPositionLabel.text = "\(callbackText) Thumb position : \(position ?? 1)"
|
||||||
|
}
|
||||||
|
|
||||||
|
func setupPicker() {
|
||||||
|
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.component.surface = item
|
||||||
|
self?.contentTopView.backgroundColor = item.color
|
||||||
|
self?.currentPositionLabel.surface = item
|
||||||
|
}
|
||||||
|
|
||||||
|
layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
|
self?.component.selectedLayout = item
|
||||||
|
self?.component.position = Int(self?.positionTextField.text ?? "1") ?? 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -74,6 +74,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
|
|||||||
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
|
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
|
||||||
MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self),
|
MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self),
|
||||||
MenuComponent(title: "ButtonIcon", completed: true, viewController: ButtonIconViewController.self),
|
MenuComponent(title: "ButtonIcon", completed: true, viewController: ButtonIconViewController.self),
|
||||||
|
MenuComponent(title: "Carousel Scrollbar", completed: false, viewController: CarouselScrollbarViewConttroller.self),
|
||||||
MenuComponent(title: "Checkbox", completed: true, viewController: CheckboxViewController.self),
|
MenuComponent(title: "Checkbox", completed: true, viewController: CheckboxViewController.self),
|
||||||
MenuComponent(title: "CheckboxItem", completed: true, viewController: CheckboxItemViewController.self),
|
MenuComponent(title: "CheckboxItem", completed: true, viewController: CheckboxItemViewController.self),
|
||||||
MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self),
|
MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user