Skip to content

Instantly share code, notes, and snippets.

@kmansoft
Created April 25, 2025 05:57
Show Gist options
  • Save kmansoft/e104c177fc9e2e4010c8f1d8301917e2 to your computer and use it in GitHub Desktop.
Save kmansoft/e104c177fc9e2e4010c8f1d8301917e2 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State private var currentCGImage: CGImage?
@State private var stateServerUrl: String = ""
@State private var stateAuthToken: String = ""
private let captureManager = CaptureManager()
var body: some View {
VStack {
CameraPreviewView(image: $currentCGImage)
.onAppear() {
captureManager.setCameraCallback { [self] (image: CGImage?) in
NSLog("Camera callback: \(image?.width ?? 0) x \(image?.height ?? 0)")
self.currentCGImage = image
}
}
Grid {
GridRow {
Text("Server URL")
TextField("https://example.com/whip",
text: $stateServerUrl)
}
GridRow {
Text("Auth token")
TextField("",
text: $stateAuthToken)
}
}
Button(action: { }) {
Text("Connect")
}
}
.padding()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment