exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6.01k stars 554 forks source link

How to display MacawView in SwiftUI ? #626

Closed NasinLin closed 4 years ago

NasinLin commented 4 years ago

I follow example of markdown to implement MacawView, but i don't know how to display in SwiftUI ? What is coder meaning?

struct Example: View {
    @State private var show = false
    @State private var opacity = 1.0
    var body: some View {
        VStack {
            MyView(coder: NSCoder)
        }
    }
}

class MyView: MacawView {
    required init?(coder aDecoder: NSCoder) {
        let text = Text(text: "Hello, World!", place: .move(dx: 145, dy: 100))
        super.init(node: text, coder: aDecoder)
    }

} 
ystrot commented 4 years ago

Already answered in #633, closing this issue.