diff --git a/Sources/FioriSwiftUICore/DataTable/DataTable.swift b/Sources/FioriSwiftUICore/DataTable/DataTable.swift index e8b7c4403..da19a060f 100644 --- a/Sources/FioriSwiftUICore/DataTable/DataTable.swift +++ b/Sources/FioriSwiftUICore/DataTable/DataTable.swift @@ -36,7 +36,7 @@ public struct DataTable: View { /// Data table's data model @ObservedObject public var model: TableModel @ObservedObject var layoutManager: TableLayoutManager - @Environment(\.sizeCategory) var sizeCategory + @Environment(\.dynamicTypeSize) var dynamicTypeSize /// Public initializer for DataTable /// - Parameter model: TableModel Object. @@ -98,8 +98,9 @@ public struct DataTable: View { self.layoutManager.currentCell = nil } } - .onChange(of: self.sizeCategory) { newValue in - self.layoutManager.sizeCategory = newValue + .onChange(of: self.dynamicTypeSize) { newValue in + self.layoutManager.dynamicTypeSize = newValue + self.layoutManager.cacheLayoutDataForMeasurement = nil self.layoutManager.layoutData = nil } .clipped() diff --git a/Sources/FioriSwiftUICore/DataTable/LayoutData.swift b/Sources/FioriSwiftUICore/DataTable/LayoutData.swift index 3478244df..1f3eb37da 100644 --- a/Sources/FioriSwiftUICore/DataTable/LayoutData.swift +++ b/Sources/FioriSwiftUICore/DataTable/LayoutData.swift @@ -7,6 +7,8 @@ class LayoutData { var sizeClass: UserInterfaceSizeClass = .compact + var dynamicTypeSize: DynamicTypeSize? + var editMode: TableModel.EditMode = .none var hasHeader: Bool = false diff --git a/Sources/FioriSwiftUICore/DataTable/TableLayoutManager.swift b/Sources/FioriSwiftUICore/DataTable/TableLayoutManager.swift index 3ce190cdf..d51fd2d00 100644 --- a/Sources/FioriSwiftUICore/DataTable/TableLayoutManager.swift +++ b/Sources/FioriSwiftUICore/DataTable/TableLayoutManager.swift @@ -15,7 +15,7 @@ class TableLayoutManager: ObservableObject { var sizeClass: UserInterfaceSizeClass = .compact - var sizeCategory: ContentSizeCategory? { + var dynamicTypeSize: DynamicTypeSize? { didSet { self.needsCalculateLayout = true } diff --git a/Sources/FioriSwiftUICore/DataTable/TableLayoutMangerExtension.swift b/Sources/FioriSwiftUICore/DataTable/TableLayoutMangerExtension.swift index 459c0817f..628f84a68 100644 --- a/Sources/FioriSwiftUICore/DataTable/TableLayoutMangerExtension.swift +++ b/Sources/FioriSwiftUICore/DataTable/TableLayoutMangerExtension.swift @@ -14,6 +14,7 @@ extension TableLayoutManager { newWorkItem = DispatchWorkItem { tmpLayoutData.editMode = self.model.editMode tmpLayoutData.sizeClass = self.sizeClass + tmpLayoutData.dynamicTypeSize = self.dynamicTypeSize tmpLayoutData.size = size tmpLayoutData.headerCellPadding = self.model.headerCellPadding tmpLayoutData.dataCellPadding = self.model.dataCellPadding @@ -172,9 +173,9 @@ extension TableLayoutManager { return CGSize(width: strSize.width + 32, height: strSize.height + 71) } - if let cachedLD = cacheLayoutDataForMeasurement, cachedLD.size.width == size.width, cachedLD.sizeClass == self.sizeClass { + if let cachedLD = cacheLayoutDataForMeasurement, cachedLD.size.width == size.width, cachedLD.sizeClass == self.sizeClass, cachedLD.dynamicTypeSize == self.dynamicTypeSize { let width = self.totalContentWidth(cachedLD, false) - let height = self.self.totalContentHeight(cachedLD, false) + let height = self.totalContentHeight(cachedLD, false) return CGSize(width: width, height: height) } @@ -190,6 +191,7 @@ extension TableLayoutManager { tmpLayoutData.editMode = model.editMode tmpLayoutData.sizeClass = self.sizeClass + tmpLayoutData.dynamicTypeSize = self.dynamicTypeSize tmpLayoutData.size = size tmpLayoutData.headerCellPadding = model.headerCellPadding tmpLayoutData.dataCellPadding = model.dataCellPadding