Skip to content

v2.0.0

Choose a tag to compare

@jaywcjlove jaywcjlove released this 12 Aug 10:44
· 27 commits to main since this release
struct ContentView: View {
    @ObservedObject var vm: CodeMirrorVM = .init()
    @State var value: String = ""
    var body: some View {
-        CodeMirror(vm)
+        CodeMirrorView(vm, value: $value)
            .onAppear {
                vm.setContent(jsonString)
            }
    }
}

The new component CodeMirror

import SwiftUI
import CodeMirror

struct ContentView: View {
    @State var value: String = ""
    var body: some View {
        CodeMirror(value: $value)
            .onLoadSuccess() {
                print("Hello!")
            }
            .onLoadFailed { error in
                print("@@@2 \(#function) \(error)")
            }
            .onContentChange {
                print("@@@3 Content Did Change")
            }
    }
}