- The library added actor isolation like
@MainActorto remove potential race conditions. Due to this, there are major code structure updates to adopt actor isolation. - The
IQListclass is changed to an actor type. - This version now configure all the reload configuration in a new
Background Queueand it's isolated to the@ReloadActor. Now thereloadDatablock is only allowed to use@ReloadActorthings and nonisolated things. This means, it's not allowed to useUIViewor@MainActorrelated things inside it. This also prevent usingappend(_:models:section:beforeItem:afterItem:)etc functions outside. - Model we create inside the cell should confirm
Sendable.
If all your properties in a Model is Sendable then it automatically confirms to Sendable, however sometimes you may have to add @unchecked Sendable if one of the internal variables does not confirm to Sendable
struct Model: Hashable, @unchecked Sendable {
}Now reloadData provide a builder, and you should be configuring the UI with builder. To access outside variables inside the block, you may have add them to capture list.
Old approach
list.reloadData({
let section: IQSection = IQSection(identifier: "section")
list.append([section])
list.append(TableViewCell.self, models: models)
})New Approach
list.reloadData({ [models] builder in
let section: IQSection = IQSection(identifier: "section")
builder.append([section])
builder.append(TableViewCell.self, models: models)
})Old size return functions
static func estimatedSize(for model: AnyHashable?, listView: IQListView) -> CGSize
static func size(for model: AnyHashable?, listView: IQListView) -> CGSize
static func indentationLevel(for model: AnyHashable?, listView: IQListView) -> IntNew size return functions. Please note that the new function now provide Model as parameter instead of providing AnyHashable?. Also please note that the return type is changed from CGSize to CGSize?. Please make sure to adopt this change in your existing codebase.
static func estimatedSize(for model: Model, listView: IQListView) -> CGSize?
static func size(for model: Model, listView: IQListView) -> CGSize?
static func indentationLevel(for model: Model, listView: IQListView) -> IntOld modelable variables
final class TableViewCell: UITableViewCell, IQModelableCell {
// IQReorderableCell
var canMove: Bool { false }
var canEdit: Bool { false }
var editingStyle: UITableViewCell.EditingStyle { .none }
// IQSelectableCell
var isHighlightable: Bool { true }
var isDeselectable: Bool { true }
var canPerformPrimaryAction: Bool { true }
}New modelable variables. These should now be part of the Model and must confirm to IQReorderableModel, IQSelectableModel for same feature.
final class TableViewCell: UITableViewCell, IQModelableCell {
//...
struct Model: Hashable, IQReorderableModel, IQSelectableModel {
// IQReorderableModel
var canMove: Bool { false }
var canEdit: Bool { false }
var editingStyle: UITableViewCell.EditingStyle { .none }
// IQSelectableModel
var isHighlightable: Bool { true }
var isDeselectable: Bool { true }
var canPerformPrimaryAction: Bool { true }
}
}Old delegate functions
func listView(_ listView: IQListView, modifyCell cell: IQListCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, willDisplay cell: IQListCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, didEndDisplaying cell: IQListCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, modifySupplementaryElement view: UIView, section: IQSection, kind: String, at indexPath: IndexPath)
func listView(_ listView: IQListView, willDisplaySupplementaryElement view: UIView, section: IQSection, kind: String, at indexPath: IndexPath)
func listView(_ listView: IQListView, didEndDisplayingSupplementaryElement view: UIView, section: IQSection, kind: String, at indexPath: IndexPath)New delegate functions. This replaced IQListCell with some IQModelableCell, for the supplementry element functions it's UIView is now replaced by some IQModelableSupplementaryView
func listView(_ listView: IQListView, modifyCell cell: some IQModelableCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, willDisplay cell: some IQModelableCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, didEndDisplaying cell: some IQModelableCell, at indexPath: IndexPath)
func listView(_ listView: IQListView, modifySupplementaryElement view: some IQModelableSupplementaryView, section: IQSection, kind: String, at indexPath: IndexPath)
func listView(_ listView: IQListView, willDisplaySupplementaryElement view: some IQModelableSupplementaryView, section: IQSection, kind: String, at indexPath: IndexPath)
func listView(_ listView: IQListView, didEndDisplayingSupplementaryElement view: some IQModelableSupplementaryView, section: IQSection, kind: String, at indexPath: IndexPath)Old data source functions
func listView(_ listView: IQListView, supplementaryElementFor section: IQSection, kind: String, at indexPath: IndexPath) -> UIView?New data source functions. This replaced UIView by (any IQModelableSupplementaryView)?
func listView(_ listView: IQListView, supplementaryElementFor section: IQSection, kind: String, at indexPath: IndexPath) -> (any IQModelableSupplementaryView)?Old initialization functions
public init(identifier: AnyHashable, header: String? = nil, headerView: UIView? = nil, headerSize: CGSize? = nil, footer: String? = nil, footerView: UIView? = nil, footerSize: CGSize? = nil)
public init<H: IQModelableSupplementaryView>(identifier: AnyHashable, headerType: H.Type, headerModel: H.Model, footer: String? = nil, footerView: UIView? = nil, footerSize: CGSize? = nil)
public init<F: IQModelableSupplementaryView>(identifier: AnyHashable, header: String? = nil, headerView: UIView? = nil, headerSize: CGSize? = nil, footerType: F.Type, footerModel: F.Model)New initialization functions. The headerView and footerView is now removed as menioned in the last major release.
public init(identifier: AnyHashable, header: String? = nil, headerSize: CGSize? = nil, footer: String? = nil, footerSize: CGSize? = nil)
public init<H: IQModelableSupplementaryView>(identifier: AnyHashable, headerType: H.Type, headerModel: H.Model, footer: String? = nil, footerSize: CGSize? = nil)
public init<F: IQModelableSupplementaryView>(identifier: AnyHashable, header: String? = nil, headerSize: CGSize? = nil, footerType: F.Type, footerModel: F.Model)