Table - Tai-Kimura/SwiftJsonUI GitHub Wiki

Table

class: SJUITableView inherits: UITableView

Platform Support

  • UIKit: Full support (All attributes available)
  • ⚠️ SwiftUI: Partial support (Maps to List with some limitations)
  • ⚠️ Jetpack Compose: Partial support (Maps to LazyColumn with some limitations)

Attributes for Table

attribute name UIKit SwiftUI Compose XML type in json details remarks
background string/JSON Background color for the table view
separatorStyle string Separator style: none, singleLine, singleLineEtched
separatorColor string Color for separators
rowHeight float Default row height
showsVerticalScrollIndicator boolean Show vertical scroll indicator. Default: false
showsHorizontalScrollIndicator boolean Show horizontal scroll indicator. Default: false
bounces boolean Enable bounce effect
scrollEnabled boolean Enable scrolling
allowsSelection boolean Allow row selection
allowsMultipleSelection boolean Allow multiple row selection
keyboardDismissMode string Keyboard dismiss mode: none, onDrag, interactive

Properties for Table

Static Properties

open class var viewClass: SJUITableView.Type

This property will be used to decide which class to inflate with createFromJSON method. You should define the view's class on this property when you create classes inheriting from SJUITableView.

Default Configuration

SJUITableView applies the following default settings:

  • separatorStyle = .none - Removes default cell separators
  • showsVerticalScrollIndicator = false - Hides vertical scroll indicator
  • showsHorizontalScrollIndicator = false - Hides horizontal scroll indicator

Inherited Properties

SJUITableView inherits all properties from UITableView and SJUIView, including:

  • Data source and delegate management
  • Cell registration and reuse functionality
  • Section management (headers, footers)
  • Editing and selection capabilities
  • Scroll position and content management
  • Touch and gesture handling from SJUIView
  • Layout constraint management

Functions for Table

Static Methods

public class func createFromJSON(attr: JSON, target: Any, views: inout [String: UIView]) -> SJUITableView

Factory method called when the table view is created from JSON file. Override this method when you create classes inheriting from SJUITableView class.

Data Source and Delegate Integration

SJUITableView integrates seamlessly with UITableView's data source and delegate patterns:

  • Automatic delegate assignment if target conforms to UITableViewDelegate
  • Automatic data source assignment if target conforms to UITableViewDataSource
  • Support for all standard table view callbacks and methods

Inherited Methods

SJUITableView inherits all methods from UITableView and SJUIView, including:

  • Cell management (dequeueReusableCell, cellForRow, etc.)
  • Section management (numberOfSectionsInTableView, etc.)
  • Editing functionality (setEditing, deleteRows, insertRows, etc.)
  • Selection handling (selectRow, deselectRow, etc.)
  • Scroll management (scrollToRow, setContentOffset, etc.)
  • Touch and gesture handling from SJUIView
  • Layout constraint management

Usage Notes

  • Designed for integration with custom table view cells and data sources
  • Provides clean appearance with disabled separators and scroll indicators
  • Supports all standard UITableView functionality and customization
  • Integrates with SwiftJsonUI's layout and styling system