vds_ios/VDS/Components/Carousel/CarouselSlotItemModel.swift

32 lines
860 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?
/// 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
}
}
}