@@ -111,13 +111,32 @@ public protocol AppBackend {
111111
112112 func createForegroundColorContainer( for child: Widget , color: Color ) -> Widget
113113 func setForegroundColor( ofForegroundColorContainer container: Widget , to color: Color )
114+
115+ func createTable( rows: Int , columns: Int ) -> Widget
116+ func setRowCount( ofTable table: Widget , to rows: Int )
117+ func setColumnCount( ofTable table: Widget , to columns: Int )
118+ func setCell( at position: CellPosition , inTable table: Widget , to widget: Widget )
114119}
115120
116121public enum InheritedOrientation {
117122 case vertical
118123 case horizontal
119124}
120125
126+ /// The position of a cell in a table (with row and column numbers starting from 0).
127+ public struct CellPosition {
128+ /// The row number starting from 0.
129+ public var row : Int
130+ /// The column number starting from 0.
131+ public var column : Int
132+
133+ /// Creates a cell position from a row and column number (starting from 0).
134+ public init ( _ row: Int , _ column: Int ) {
135+ self . row = row
136+ self . column = column
137+ }
138+ }
139+
121140extension AppBackend {
122141 public func addChildren( _ children: [ Widget ] , toVStack container: Widget ) {
123142 for child in children {
@@ -156,12 +175,12 @@ extension AppBackend {
156175 }
157176}
158177
159- private func todo( _ message: String ) -> Never {
160- print ( message)
161- Foundation . exit ( 1 )
162- }
163-
164178extension AppBackend {
179+ private func todo( _ message: String ) -> Never {
180+ print ( " \( type ( of: self ) ) : message " )
181+ Foundation . exit ( 1 )
182+ }
183+
165184 public func show( _ widget: Widget ) {
166185 todo ( " show not implemented " )
167186 }
@@ -373,4 +392,17 @@ extension AppBackend {
373392 public func setForegroundColor( ofForegroundColorContainer container: Widget , to color: Color ) {
374393 todo ( " setForegroundColor not implemented " )
375394 }
395+
396+ public func createTable( rows: Int , columns: Int ) -> Widget {
397+ todo ( " createTable not implemented " )
398+ }
399+ public func setRowCount( ofTable table: Widget , to rows: Int ) {
400+ todo ( " setRowCount not implemented " )
401+ }
402+ public func setColumnCount( ofTable table: Widget , to columns: Int ) {
403+ todo ( " setColumnCount not implemented " )
404+ }
405+ public func setCell( at position: CellPosition , inTable table: Widget , to widget: Widget ) {
406+ todo ( " setCell not implemented " )
407+ }
376408}
0 commit comments