I'm currently developing an application using SwiftUI.
I'm looking for some way to make a background color with opacity on a Sheet view.
is there any way to do that?
I've tried to do that with a code below, I can change the color with opacity property, but I can't see a text(Sheet) under the sheet View...
import SwiftUI
struct ContentView: View {
@State var isSheet = false
var body: some View {
Button(action: {self.isSheet.toggle()}) {
Text("Sheet")
}.sheet(isPresented: $isSheet){
Color.yellow.opacity(0.5)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Xcode: Version 11.7
Swift: Swift 5