I am using Proton with swiftUI through a UIRepresentableView. I am having trouble enabling the scroll functionality when the editor reaches its container size.
I set up my view this way:
struct RepresentableRichTextEditor: UIViewRepresentable {
@Binding var attributedText: NSAttributedString
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
let commandExecutor = EditorCommandExecutor()
func makeUIView(context: Context) -> UIView {
let editor = EditorView()
editor.delegate = context.coordinator
//This forces the editor view to scroll however disables the auto layout provided by the representable view
//editor.translatesAutoresizingMaskIntoConstraints = false
//editor.maxHeight = 300
EditorViewContext.shared.delegate = context.coordinator
editor.setFocus()
return editor
}
func updateUIView(_ uiView: UIView, context: Context) {
//Update logic here
}
}
I have tried using .frame(height) in the parent SwiftUI View but this didn't seem to affect the underlying editorView.
Does anyone know how to get scrolling working with SwiftUI?
I am using Proton with swiftUI through a UIRepresentableView. I am having trouble enabling the scroll functionality when the editor reaches its container size.
I set up my view this way:
I have tried using .frame(height) in the parent SwiftUI View but this didn't seem to affect the underlying editorView.
Does anyone know how to get scrolling working with SwiftUI?
Many thanks