swiftui-pipify icon indicating copy to clipboard operation
swiftui-pipify copied to clipboard

Cannot update view

Open giarchive opened this issue 3 months ago • 0 comments

In a simple view that displays the following text, even if you change the content of the text, the content of the PiP will not be updated. The same result is if you reopen PiP or assign an .id to View.

import SwiftUI
import Pipify

struct ContentView: View {
    @State var displayContent = false
    @State var isPresented = false
    
    @State var testText = "ABC"
    var body: some View {
        Button(action: {
            testText = "DEF"
        }) {
            Text("Change text")
        }
        VStack {
            Text(testText)
        }
        .background() {
            Color.white
        }
        .pipify(isPresented: $isPresented)
        .padding()
        Button(action: {
            isPresented.toggle()
        }) {
            Text("Start PiP")
        }
    }
}

giarchive avatar Sep 17 '25 05:09 giarchive