kabiroberai / node-swift

Create Node modules in Swift
MIT License
492 stars 16 forks source link

How can I pass an object as an input to a method? #43

Open karaggeorge opened 1 month ago

karaggeorge commented 1 month ago

Thank you so much for this project! It's been amazing so far. I'm reading through old issues and learning how to use all the different patterns. This is something I haven't found an example for yet:

I have a struct like:

struct Options {
    let destination: String
    let framesPerSecond: Int
    let cropRect: CGRect?
}

I'd like to expose a function that can take an object from js as input that has this shape, and then somehow type-cast it in Swift to use it as the struct

So I could for example do options.destination