Eduard
Eduard

Reputation: 176

How to add a table to a NS/UITextView in Swift?

I can see in Apple Notes and other notes app that they have tables embedded into the text editor. Swift has NSTextTable, but it's just available for macOS. I'm wondering how I can add a table to both, macOS and iOS?

In addition, these tables should be interactive like in Apple Notes, like I can add a row or column, move them around, etc. I have seen this project which enables you to embed a NS/UIView into the editor, but this seems more like a hack.

Any ideas?

Upvotes: 1

Views: 557

Answers (1)

maximkrouk
maximkrouk

Reputation: 259

I think that there is no simple way to add such attachments to a textView on iOS, you may try to find something in NSAttributedString, but probably it won't have a solution, so https://github.com/vlas-voloshin/SubviewAttachingTextView looks like a good option.

Upvotes: 1

Related Questions