vds_ios/VDS/Components/Carousel/CarouselSlotItemModel.swift
2024-07-17 18:32:04 +05:30

34 lines
913 B
Swift

//
// CarouselSlotItemModel.swift
// VDS
//
// Created by Kanamarlapudi, Vasavi on 30/06/24.
//
import Foundation
import UIKit
import VDSCoreTokens
/// A custom data type that holds the style and component for a slot of the 'Carousel' component.
public struct CarouselSlotItemModel {
/// Style props if provided any
public var style: CarouselRenderItemStyle?
public let defaultHeight: CGFloat = 50.0
/// Component to be show on Carousel slot
public var component: UIView?
public init(style: CarouselRenderItemStyle? = nil, component: UIView? = nil) {
self.style = style
self.component = component
if let color = style?.backgroundColor {
self.component?.backgroundColor = .init(hexString: color)
}
if let borderRadius = style?.borderRadius {
self.component?.layer.cornerRadius = borderRadius
}
}
}