Created
July 23, 2020 21:16
-
-
Save mattyoung/43cf8b749a1b9d9736969dec77b51767 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct RedactedReasonReplaceIsPlaceholder: View { | |
@Environment(\.redactionReasons) private var redactionReason | |
let junk: RedactionReasons = .placeholder | |
var body: some View { | |
VStack { | |
Text("Want this to be shown even when redacted!") | |
.redacted(reason: .init()) | |
Text("\(redactionReason == .placeholder ? "YES .placeholder" : "No, don't know what!") rawValue: \(redactionReason.rawValue)") | |
.redacted(reason: .init()) | |
// why Image not redacted? Image can have sensitive data! | |
Image("ChickenNuggets") | |
.resizable() | |
.aspectRatio(contentMode: .fit) | |
.frame(width: 80) | |
Text("This is placeholder text") | |
Text("More placeholder text") | |
// not redacted, ok, fine | |
Capsule() | |
.fill(Color.green) | |
.frame(height: 50) | |
} | |
.redacted(reason: .placeholder) | |
// this seems to do the same, what's the purpose of this evn var? | |
// .environment(\.redactionReasons, .placeholder) | |
} | |
} | |
struct RedactedReasonReplaceIsPlaceholder_Previews: PreviewProvider { | |
static var previews: some View { | |
RedactedReasonReplaceIsPlaceholder() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment