-
Notifications
You must be signed in to change notification settings - Fork 83
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
LayoutConstraints issue #126
Comments
@writing-shed, thanks for reporting the issue. I have not yet got a chance to look into using Proton with SwiftUI. However, I do plan to try it out and making Proton have more compatible API. However, that might not be soon enough as there are some other improvements that I am focussing on in Proton. Having said that, to provide a bit more context on how scrolling works in |
I have this same problem. Causing quite the headache. @rajdeep I'm getting fairly advanced in my SwiftUI usage. I would be happy to collaborate and try and get this as supported in SwiftUI as possible. Having used Proton for about a year now, I have some ideas. |
@bryan1anderson, it would be great to collaborate, and I would love to hear about your experience and suggestions. We can discuss the ideas related to SwiftUI here: #83 Regarding this issue, I have not been able to look much into SwiftUI support as yet. Having said that, I wanted to optimise the performance part of Proton before looking into the SwiftUI support. I have a branch where significant changes have been made, including to the autolayout constraints. Have a look at this branch: https://github.com/rajdeep/proton/tree/performance-update-2 |
My app embeds an EditorView in a SwiftUI UIViewRepresentable struct which is the documented way to use UIKit views. The problem is that the text does not scroll when it reaches the bottom of the view. However, if I close the view and reopen it things wok as expected.
I have found that AutogrowingTextView.LayoutSubviews is only called once when the view opens, so isScrollEnabled is left set to false. Closing and reopening the view sorts this because there is sufficient text available.
The problem seems to be the layoutConstraints because the console contains the following immediately after EditorView.setup is called.
I can overcome the issue by setting isScrollEnabled after every keystroke.
2021-08-08 10:15:17.067778+0100 Easiwriter[3611:91422] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSAutoresizingMaskLayoutConstraint:0x60000243ae40 h=--& v=--& Proton.EditorView:0x7fb90d839800.height == 759.333 (active)>",
"<NSLayoutConstraint:0x60000240ecb0 V:|-(0)-[Proton.RichTextView:0x7fb90d0b4800] (active, names: '|':Proton.EditorView:0x7fb90d839800 )>",
"<NSLayoutConstraint:0x60000240eb70 Proton.RichTextView:0x7fb90d0b4800.bottom == Proton.EditorView:0x7fb90d839800.bottom (active)>",
"<NSLayoutConstraint:0x600002409ae0 Proton.RichTextView:0x7fb90d0b4800.height >= 926 (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002409ae0 Proton.RichTextView:0x7fb90d0b4800.height >= 926 (active)>
The text was updated successfully, but these errors were encountered: