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

Using CodeEditSourceEditor does not display text #256

Open
wisepmlin opened this issue Jul 8, 2024 · 1 comment
Open

Using CodeEditSourceEditor does not display text #256

wisepmlin opened this issue Jul 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@wisepmlin
Copy link

Description

截屏2024-07-08 11 48 23

To Reproduce

struct SerialReception: View {
@binding var document: String
@State private var language: CodeLanguage = .default
@State private var theme: EditorTheme = .wise
@State private var font: NSFont = NSFont.monospacedSystemFont(ofSize: 12, weight: .regular)
@AppStorage("wrapLines") private var wrapLines: Bool = true
@State private var cursorPositions: [CursorPosition] = []
var body: some View {
CodeEditSourceEditor(
$document,
language: language,
theme: theme,
font: font,
tabWidth: 4,
lineHeight: 1.2,
wrapLines: wrapLines,
cursorPositions: $cursorPositions
)
}
}

Expected Behavior

截屏2024-07-08 11 54 30

Version Information

CodeEditSourceEditor: [e.g. 0.x.y]
macOS: [e.g. 15.0]
Xcode: [e.g. 16.0 beta]

Additional Context

No response

Screenshots

No response

@wisepmlin wisepmlin added the bug Something isn't working label Jul 8, 2024
@wisepmlin
Copy link
Author

@ViewBuilder
func reception() -> some View {
if !viewModel.isObject {
TextEditor(text: $viewModel.receivedData)
} else {
SerialReception(document: $viewModel.receivedData)
.id(viewModel.receivedData)
}
}
.id(viewModel.receivedData)
An id binding is required to update the UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant