CodeEditorView icon indicating copy to clipboard operation
CodeEditorView copied to clipboard

State up front that there are two products

Open ayrtonsoftware opened this issue 2 years ago • 1 comments

When I try to compile the code, I get:

Cannot find type 'TextLocated' in scope

` import SwiftUI import CodeEditorView

struct MyCodeEditorView: View { @State private var text: String = "My awesome code..." @State private var position: CodeEditor.Position = CodeEditor.Position() @State private var messages: Set<TextLocated<Message>> = Set()

@Environment(\.colorScheme) private var colorScheme: ColorScheme

var body: some View {
  CodeEditor(text: $text, position: $position, messages: $messages, language: .swift)
    .environment(\.codeEditorTheme,
                 colorScheme == .dark ? Theme.defaultDark : Theme.defaultLight)
}

} `

ayrtonsoftware avatar Nov 02 '23 00:11 ayrtonsoftware

The package includes two products: (1) CodeEditorView and (2) LanguageSupport. The missing symbol is located in the second product — i.e., you need to import that, too.

This needs to be better explained in the documentation. I will keep this issue open to remind me of that. (I'll also rename it.) Thanks for the feedback!

mchakravarty avatar Nov 05 '23 20:11 mchakravarty