Skip to content

Conversation

adJGraeser
Copy link

Currently there is no way to create a custom TableBorderSelector, since the initialiser of TableBorderSelector and TableBounds aren't exposed. This PR changes those to public. With that we can now create custom TableBorderSelector like this one:

extension TableBorderSelector {
    public static var firstHorizontalBorder: TableBorderSelector {
        TableBorderSelector { tableBounds, borderWidth in
            guard tableBounds.rowCount >= 1 else { return [] }

            return [
                tableBounds.bounds(forRow: 0)
                    .insetBy(dx: -borderWidth, dy: -borderWidth)
            ]
                .map {
                    CGRect(
                        origin: .init(x: $0.minX, y: $0.maxY - borderWidth),
                        size: .init(width: $0.width, height: borderWidth)
                    )
                }
        }
    }
}

…aliser of TableBorderSelector and TableBounds
@adJGraeser adJGraeser changed the title custom-tableborderselector: custom-tableborderselector: Provide initi… Provide initialiser for custom TableBorderSelector Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant