Closed Simimi-dot closed 5 months ago
@Simimi-dot, have you tried running the provided example project on the real device? Is it the same there?
I just tried it and it's working fine for me. https://github.com/JayantBadlani/ScreenShield/assets/37996543/e0d6edd7-052b-4c0b-99ee-ea00b0aaf435
@JayantBadlani Yes, I immediately updated and installed it, and on the preview and on the simulator and on the real View device they are painted white. I tested on iOS 17.2
@Simimi-dot, I'm unable to reproduce your issue. The screen recording I shared is also from iOS 17.2. Please provide your example project or file so I can replicate it on my end.
.protectScreenshot()
.onAppear(perform: {
ScreenShield.shared.protectFromScreenRecording()
})
I tested the problem and discovered that it turns out that this code cannot be attached to internal views, because of this everything breaks. You can use these modifiers only on the outermost view in the hierarchy on the screen, for example:
var body: some View {
TabView(selection: $currentTab) {
ForEach(0..<3, id: \.self) { indexOfPlayer in
TestSoloVideo(videoStringURL: recipeURL)
}
}
.overlay(alignment: .bottom) {
HStack {
ForEach(0..<3, id: \.self) { indexOfPage in
Circle()
.fill(currentTab == indexOfPage ? Color.white : Color.gray)
.frame(width: 10, height: 10)
}
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
.frame(width: 375, height: 230)
.clipShape(RoundedRectangle(cornerRadius: 25))
.shadow(color: .black, radius: 4, y: 5)
.protectScreenshot()
.onAppear(perform: {
ScreenShield.shared.protectFromScreenRecording()
})
}
var body: some View {
TabView(selection: $currentTab) {
ForEach(0..<3, id: \.self) { indexOfPlayer in
TestSoloVideo(videoStringURL: recipeURL)
.protectScreenshot()
.onAppear(perform: {
ScreenShield.shared.protectFromScreenRecording()
})
}
}
.overlay(alignment: .bottom) {
HStack {
ForEach(0..<3, id: \.self) { indexOfPage in
Circle()
.fill(currentTab == indexOfPage ? Color.white : Color.gray)
.frame(width: 10, height: 10)
}
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
.frame(width: 375, height: 230)
.clipShape(RoundedRectangle(cornerRadius: 25))
.shadow(color: .black, radius: 4, y: 5)
}
Perhaps I missed something from the description
When installing version 1.2.1, the View is no longer visible on the simulator, preview, or real device; it is painted white