0

I am trying to rotate the header of a TableColumn. I would also like it not being truncated or cropped.

This does not work:

TableColumn(Text("Column Name").rotationEffect(Angle(degrees: 45)), value: \.name))

It creates the error Initializer 'init(_:value:comparator:)' requires that 'some View' conform to 'StringProtocol'.

2
  • I doubt this is supported by SwiftUI. You most likely need to use AppKit’s NSTableView or create your own table from primitives. Commented Apr 15 at 23:29
  • You could try using a custom HStack header, such as HStack { Text("Column Name").rotationEffect(.degrees(-45)) } that you add before the Table and use TableColumn("", value: \.name) Commented Apr 15 at 23:40

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.