@@ -209,6 +209,12 @@ public class TableView: UIView {
209
209
}
210
210
}
211
211
212
+ /// Determines if cell selection using 2-finger drag gesture is enabled
213
+ public var isCellSelectionEnabled : Bool {
214
+ get { tableView. isCellSelectionEnabled }
215
+ set { tableView. isCellSelectionEnabled = newValue }
216
+ }
217
+
212
218
/// Bounds observer for the `TableView`. Typically, this will be the `Attachment` that hosts the `TableView`.
213
219
/// - Note: In absence of a `boundObserver`, the `TableView` will not autoresize when the content in the cells
214
220
/// are changed.
@@ -294,9 +300,9 @@ public class TableView: UIView {
294
300
/// - config: Configuration for `TableView`
295
301
/// - cellEditorInitializer: Custom initializer for `EditorView` within `TableCell`. This will also be used when creating new cells as a
296
302
/// return of adding new row or column, or cells being split.
297
- public convenience init ( config: GridConfiguration , cellEditorInitializer: GridCell . EditorInitializer ? = nil ) {
303
+ public convenience init ( config: GridConfiguration , cellEditorInitializer: GridCell . EditorInitializer ? = nil , isCellSelectionEnabled : Bool = false ) {
298
304
let tableView = TableContentView ( config: config, editorInitializer: cellEditorInitializer)
299
- self . init ( config: config, tableView: tableView)
305
+ self . init ( config: config, tableView: tableView, isCellSelectionEnabled : isCellSelectionEnabled )
300
306
}
301
307
302
308
/// Initializes `TableView` using the provided configuration.
@@ -307,12 +313,12 @@ public class TableView: UIView {
307
313
/// return of adding new row or column, or cells being split.
308
314
/// - Important:
309
315
/// Care must be taken that the number of cells are correct per the configuration provided, failing which the `TableView` rendering may be broken.
310
- public convenience init ( config: GridConfiguration , cells: [ TableCell ] , cellEditorInitializer: TableCell . EditorInitializer ? = nil ) {
316
+ public convenience init ( config: GridConfiguration , cells: [ TableCell ] , cellEditorInitializer: TableCell . EditorInitializer ? = nil , isCellSelectionEnabled : Bool = false ) {
311
317
let tableView = TableContentView ( config: config, cells: cells, editorInitializer: cellEditorInitializer)
312
- self . init ( config: config, tableView: tableView)
318
+ self . init ( config: config, tableView: tableView, isCellSelectionEnabled : isCellSelectionEnabled )
313
319
}
314
320
315
- private init ( config: GridConfiguration , tableView: TableContentView ) {
321
+ private init ( config: GridConfiguration , tableView: TableContentView , isCellSelectionEnabled : Bool ) {
316
322
self . tableView = tableView
317
323
let boundsShadowColors = [
318
324
config. boundsLimitShadowColors. primary. cgColor,
@@ -325,7 +331,7 @@ public class TableView: UIView {
325
331
self . config = config
326
332
super. init ( frame: . zero)
327
333
self . leadingShadowConstraint = leadingShadowView. leadingAnchor. constraint ( equalTo: self . leadingAnchor)
328
-
334
+ self . isCellSelectionEnabled = isCellSelectionEnabled
329
335
setup ( )
330
336
}
331
337
0 commit comments