mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
35 lines
1.1 KiB
Swift
35 lines
1.1 KiB
Swift
import Foundation
|
|
import SwiftSignalKit
|
|
|
|
public protocol ListViewItem {
|
|
func nodeConfiguredForWidth(width: CGFloat, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: (ListViewItemNode, () -> Void) -> Void)
|
|
func updateNode(node: ListViewItemNode, width: CGFloat, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: (ListViewItemNodeLayout, () -> Void) -> Void)
|
|
|
|
var accessoryItem: ListViewAccessoryItem? { get }
|
|
var headerAccessoryItem: ListViewAccessoryItem? { get }
|
|
var selectable: Bool { get }
|
|
|
|
func selected()
|
|
}
|
|
|
|
public extension ListViewItem {
|
|
var accessoryItem: ListViewAccessoryItem? {
|
|
return nil
|
|
}
|
|
|
|
var headerAccessoryItem: ListViewAccessoryItem? {
|
|
return nil
|
|
}
|
|
|
|
var selectable: Bool {
|
|
return false
|
|
}
|
|
|
|
func selected() {
|
|
}
|
|
|
|
func updateNode(node: ListViewItemNode, width: CGFloat, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: (ListViewItemNodeLayout, () -> Void) -> Void) {
|
|
completion(ListViewItemNodeLayout(contentSize: node.contentSize, insets: node.insets), {})
|
|
}
|
|
}
|