From df91effafb736f9a29f25e0984e8b871b68fd3e1 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Fri, 18 Aug 2023 13:45:22 -0500 Subject: [PATCH] updates for debugging Signed-off-by: Matt Bruce --- VDSSample/ViewControllers/LabelViewController.swift | 2 +- .../ViewControllers/TitleLockupViewController.swift | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/VDSSample/ViewControllers/LabelViewController.swift b/VDSSample/ViewControllers/LabelViewController.swift index a4615c7..9f523d5 100644 --- a/VDSSample/ViewControllers/LabelViewController.swift +++ b/VDSSample/ViewControllers/LabelViewController.swift @@ -333,7 +333,7 @@ extension LabelViewController: ComponentSampleable { } extension BaseViewController { - func descriptionFor(style: TextStyle, useScaledLineHeight: Bool = false, scaledMode: Bool) -> String { + func descriptionFor(style: TextStyle, useScaledLineHeight: Bool = false, scaledMode: Bool = false) -> String { let scaledFont = style.font.scaledFont var customizedDesc: String = "Name: \(style.rawValue) \nFont Face-Weight: \(style.font.fontName)" customizedDesc += "\nVDS LetterSpacing: \(style.letterSpacing)" diff --git a/VDSSample/ViewControllers/TitleLockupViewController.swift b/VDSSample/ViewControllers/TitleLockupViewController.swift index 2e2c686..5ef509f 100644 --- a/VDSSample/ViewControllers/TitleLockupViewController.swift +++ b/VDSSample/ViewControllers/TitleLockupViewController.swift @@ -113,15 +113,19 @@ class TitleLockupViewController: BaseViewController { titleTextField.text = titleModel.text subTitleTextField.text = subTitleModel.text + setTitleModel() updateOtherTextStyles() } func setTitleModel() { + var titleTextStyle: TextStyle? if let text = titleTextField.text, !text.isEmpty { component.titleModel = TitleLockup.TitleModel(text: text, isBold: titleIsBold.isOn, standardStyle: titleStandardStylePickerSelectorView.selectedItem) + titleTextStyle = titleIsBold.isOn ? titleStandardStylePickerSelectorView.selectedItem.value.bold : titleStandardStylePickerSelectorView.selectedItem.value.regular } else { component.titleModel = nil } + debug(type: "Title", textStyle: titleTextStyle) } func updateOtherTextStyles() { @@ -136,17 +140,25 @@ class TitleLockupViewController: BaseViewController { if let text = subTitleTextField.text, !text.isEmpty { component.subTitleModel = TitleLockup.SubTitleModel(text: text, standardStyle: style, textColor: subtitleColorPickerSelectorView.selectedItem) + debug(type: "SubTitle", textStyle: style.value.regular) } else { component.subTitleModel = nil } if let text = eyebrowTextField.text, !text.isEmpty { component.eyebrowModel = TitleLockup.EyebrowModel(text: text, isBold: eyebrowIsBold.isOn, standardStyle: style) + debug(type: "EyeBrow", textStyle: eyebrowIsBold.isOn ? style.value.bold : style.value.regular) + } else { component.eyebrowModel = nil } } + func debug(type: String, textStyle: TextStyle?) { + guard let textStyle else { return } + DebugLog("\n\(type)\n\(descriptionFor(style: textStyle))\n\n") + } + //Picker func setupPicker(){ surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in