Is there a way to share a Swift state between separate files? I've tried:
public struct VideoPlayerControlsView : View {
@State public var playerPaused : Bool = true
// More Code Here
}
And would like to reference this in another file (where the two are linked, so I can change one and the other would reflect this change), I think that it would be achieved by a Binding:
struct VideoView: View {
@Binding var videoPos : Double
//more code here
}
But then I'm told: 'init(videoPos)' declared here' alongside that I should change:
PlaygroundPage.current.setLiveView(VideoView()) to PlaygroundPage.current.setLiveView(VideoView(videoPos: <#Binding<Double>#>)) but not sure what to set the place holder value to, I also don't think this is the right way to do what I'm trying to achieve?
How can I do this?
NOTE: I'm using Swift Playgrounds on Mac