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

use NSTextContainer from Notepad initializer #18

Open
DivineDominion opened this issue Jul 21, 2017 · 3 comments
Open

use NSTextContainer from Notepad initializer #18

DivineDominion opened this issue Jul 21, 2017 · 3 comments

Comments

@DivineDominion
Copy link
Collaborator

Notepad.init(frame: CGRect, textContainer: NSTextContainer?) does not actually use textContainer. This at least violates obvious expectations :) (And the Liskov Substitution Principle)

@ruddfawcett
Copy link
Owner

Thanks for filing issue. If my memory serves me correctly, I think that that was intentional... Perhaps it's a required initializer?

@DivineDominion
Copy link
Collaborator Author

Yes it is, but if you call Notepad(frame: someFrame, textContainer: myTextContainer), then myTextContainer will be discarded and replaced by another one. While I don't like to fatalError out of situations like this for various reasons (same rationale as for partial functions), that would at least be less surprising and easy to notice.

Simply using the passed-in text container would be best, of course :) I don't know, yet, if that's not possible at all. And this is not very pressing an issue for me personally, so I'm okay with letting this sit here for a while.

@ruddfawcett
Copy link
Owner

Totally makes sense regarding the discarding of the passed in textContainer. I'm fine with letting this sit for a little bit as well, as I think I tried a few things that didn't work in the past.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants