diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileletModel.swift b/MVMCoreUI/Atomic/Atoms/Views/TileletModel.swift index b41d9eef..7cc9747e 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileletModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileletModel.swift @@ -68,23 +68,35 @@ open class TileletModel: MoleculeModelProtocol { public func titleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.TitleModel? { guard let title else { return nil } let attrs = title.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) - let style: TextStyle? = title.fontStyle?.vdsTextStyle() - if let style, let standardStyle = Tilelet.TitleModel.StandardStyle(rawValue: style.toStandardStyle().rawValue) { - return .init(text: title.text, textAttributes: attrs, standardStyle: standardStyle) - } else { - return .init(text: title.text, textAttributes: attrs) - } - } + + do { + if let style = title.fontStyle { + return .init(text: title.text, + textAttributes: attrs, + standardStyle: try style.vdsSubsetStyle()) + } + } catch MVMCoreError.errorObject(let object) { + MVMCoreLoggingHandler.shared()?.addError(toLog: object) + } catch { } + + return .init(text: title.text, textAttributes: attrs) + } + public func subTitleModel(delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) -> Tilelet.SubTitleModel? { guard let subTitle else { return nil } let attrs = subTitle.attributes?.toVDSLabelAttributeModel(delegateObject: delegateObject, additionalData: additionalData) - let style: TextStyle? = subTitle.fontStyle?.vdsTextStyle() - if let style, let standardStyle = Tilelet.SubTitleModel.StandardStyle(rawValue: style.toStandardStyle().rawValue) { - return .init(text: subTitle.text, textAttributes: attrs, standardStyle: standardStyle) - } else { - return .init(text: subTitle.text, textAttributes: attrs) - } + do { + if let style = subTitle.fontStyle { + return .init(text: subTitle.text, + otherStandardStyle: try style.vdsSubsetStyle(), + textAttributes: attrs) + } + } catch MVMCoreError.errorObject(let object) { + MVMCoreLoggingHandler.shared()?.addError(toLog: object) + } catch { } + + return .init(text: subTitle.text, textAttributes: attrs) } public func encode(to encoder: Encoder) throws { diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift index 034420cd..6c48398b 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/TitleLockupModel.swift @@ -138,7 +138,7 @@ public class TitleLockupModel: MoleculeModelProtocol, ParentMoleculeModelProtoco do { if let style = subTitle.fontStyle { return .init(text: subTitle.text, - standardStyle: try style.vdsSubsetStyle(), + otherStandardStyle: try style.vdsSubsetStyle(), textColor: subTitleColor, textAttributes: attrs, numberOfLines: subTitle.numberOfLines ?? 0)