Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt TextKit 2 (Explicitly) #153

Open
DominikBucher12 opened this issue Mar 1, 2024 · 5 comments
Open

Adopt TextKit 2 (Explicitly) #153

DominikBucher12 opened this issue Mar 1, 2024 · 5 comments
Labels
tech Internal tech fixes, refactorings etc.

Comments

@DominikBucher12
Copy link
Collaborator

We should move out of using NSLayoutManager and NSTextStorage and NSTextContainer in order to adopt TextKit2.

Currently I believe there must be some other fix to lines and style setting to don't than iterating through textStorage (or we can use new NSTextLayoutManager from TextKit 2 to access this)

The issue with TextKit1 is that it doesn't support native bullet points and numbered points with NSTextList API for a very convenient way to handle those.

Let's maybe wrap the NSLayoutManager for iOS 15 and for iOS 16 use NSTextLayoutManager 🆕🆕🆕

@DominikBucher12 DominikBucher12 added the tech Internal tech fixes, refactorings etc. label Mar 1, 2024
@DominikBucher12 DominikBucher12 changed the title Adopt TextKit 2 (The explicitly) Adopt TextKit 2 (Explicitly) Mar 1, 2024
@danielsaidi
Copy link
Owner

I've had discussions about TextKit 2 with people who know a lot about it, and this seems to be quite a mess :(

Not sure if this should be an open ticket, or if we can mix and match TK1 and TK2 to implement different features?

@DominikBucher12
Copy link
Collaborator Author

or if we can mix and match TK1 and TK2 to implement different features?

Hmm I am not quite sure it works that way Daniel :(

The current only solution is either TK1 or TK2, since when we access some TK1 properties, TextKit will automatically fallback to 1.

Sorry for such long time without any work or comments, I am just buried with lot of other stuff... But we can have some discussion some other time and I might be able to once again do some research and do this integration smoothly.

@DominikBucher12
Copy link
Collaborator Author

IMHO creating abstraction as I suggested:

Let's maybe wrap the NSLayoutManager (TK1) for iOS 15 and for iOS 16 use NSTextLayoutManager (TK2)

would make most sense, but by the time I will get into this I think no one will support iOS 15 :D :D :D

@danielsaidi
Copy link
Owner

@DominikBucher12 Would it make sense to use Glyph?

https://github.com/chimeHQ/Glyph

@DominikBucher12
Copy link
Collaborator Author

This would serve as a great inspiration... I need to take a look into that + it looks just like a bunch of extensions in a similar way we tried with paragraphs...

I think there are more issues than just this (as you remember, we were dealing with paragraph alignment behaving funky because of selected text vs text in some range vs selected line vs carret being at last character vs macOS behaviour)

It would be wise IMHO to go through the code and figure out the behaviour differences between macOS and iOS/iPad OS, its probably not good idea to try to have one code for all platforms with some ifdefs... But again when I have some time I can try take a look at both and properly test the solution...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech Internal tech fixes, refactorings etc.
Projects
None yet
Development

No branches or pull requests

2 participants