dwarvesf / CodeViewer

A custom code editor SwiftUI view
MIT License
146 stars 19 forks source link

Content should be a @State variable #5

Closed L1cardo closed 4 years ago

L1cardo commented 4 years ago

The content should be a @State variable, and then we can use it like this.

@State private var json = ""

var body: some View {
    CodeViewer(content: $json)
    .onAppear {
        json = """
        {
            "text": "hello world"
        }
        """
    }
}
phucledien commented 4 years ago

ok, that sounds cool. Feel free to implement it if you have time @L1cardo 👍

L1cardo commented 4 years ago

ok, that sounds cool. Feel free to implement it if you have time @L1cardo 👍

I really want to implement it, but I need to prepare for my exam. Can you do that in your spare time?

phucledien commented 4 years ago

ok, that sounds cool. Feel free to implement it if you have time @L1cardo 👍

I really want to implement it, but I need to prepare for my exam. Can you do that in your spare time?

Haha, okay then. Good luck with your exam 💯

phucledien commented 4 years ago

version 1.2.0 now supported @State 👍