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

What's your take on making this library platform-independent? #14

Open
Moriquendi opened this issue Mar 21, 2021 · 2 comments
Open

What's your take on making this library platform-independent? #14

Moriquendi opened this issue Mar 21, 2021 · 2 comments
Labels
question Further information is requested

Comments

@Moriquendi
Copy link

Hello Twitter folks,
What's your take on making this library platform-independent?
Specifically, it now relies on UIKit which prevents it from being used on macOS.

Is supporting macOS on the radar? Both UITextView and NSTextView relies on the same NSTextStorage and NSTextContainer classes so I think this should be possible without a major refactor.
Would you accept a contribution that tries to make the library work on macOS?

Cheers 👋

@niw
Copy link
Contributor

niw commented Mar 21, 2021

Hi, @Moriquendi

Short answer is that we don’t have a plan to make it works on AppKit natively for now.

There are a few reasons. First, AppKit’s NSTextView and UIKit’s UITextView are both using same NSTextStorage and NSTextContainer as you mentioned, however both APIs are not same and behaviors are not same. This is because NSTextView is actually very, very old component that is built since original Nextstep era, yet also UITextView is built for touch interactions for iOS.
Another reason is that there is Mac Catalyst which allows UIKit app runs on macOS, which covers our use case of macOS support (I know that is not what you want probably, though.)

I believe, however, some techniques that Twitter Text Editor is using can be used as-is with NSTextView such as how it provides APIs to apply attributes. Therefore in future at some point, probably some potion of API set can be platform independent and can be exported from Twitter Text Editor for AppKit, like when SwiftUI API provides seamless API for both platform for example. Yet, just I think it’s not now.

@niw niw changed the title One line summary of the issue What's your take on making this library platform-independent? Mar 21, 2021
@Moriquendi
Copy link
Author

Gotcha, thanks @niw.
I'm gonna keep fingers crossed for making libraries like this work on macOS too. In the meantime, I might play around with porting some of the functionalities to macOS. I'll let you know if I have something to share or contribute :)

@niw niw added the question Further information is requested label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants