45 lines
1.3 KiB
Swift
45 lines
1.3 KiB
Swift
//
|
|
// TiletBadgeModel.swift
|
|
// VDS
|
|
//
|
|
// Created by Matt Bruce on 1/6/23.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
extension Tilelet {
|
|
|
|
/// Model that represents the options available for the badge.
|
|
public struct BadgeModel: Equatable, Identifiable {
|
|
|
|
public static func == (lhs: BadgeModel, rhs: BadgeModel) -> Bool {
|
|
lhs.id == rhs.id
|
|
}
|
|
|
|
public var id: String = UUID().uuidString
|
|
|
|
/// Text that will be used for the badge.
|
|
public var text: String = ""
|
|
|
|
/// Fill color that will be used for the badge.
|
|
public var fillColor: Badge.FillColor
|
|
|
|
/// Current Surface and this is used to pass down to child objects that implement Surfacable
|
|
public var surface: Surface
|
|
|
|
/// Number of lines that will be used for the badge.
|
|
public var numberOfLines: Int
|
|
|
|
/// Max width that will be used for the badge.
|
|
public var maxWidth: CGFloat?
|
|
|
|
public init(text: String, fillColor: Badge.FillColor = .red, surface: Surface = .light, numberOfLines: Int = 0, maxWidth: CGFloat? = nil) {
|
|
self.text = text
|
|
self.fillColor = fillColor
|
|
self.surface = surface
|
|
self.numberOfLines = numberOfLines
|
|
self.maxWidth = maxWidth
|
|
}
|
|
}
|
|
}
|