Error with `.slideOverCard`
sunshinewithmoonlight opened this issue · comments
iOS 15.2
Xcode Version 13.2.1 (13C100)
My ContentView.swift
:
import SwiftUI
struct ContentView: View {
@State private var showCard = false
var body: some View {
HStack{
Text("Hello, world!")
.padding()
Button("abb"){
showCard = true
}
}
.slideOverCard(isPresented: $showCard ) {
Text("Hello, world!")
// Here goes your awesome content
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
And the error:
🔴 Value of type 'HStack<TupleView<(some View, Button<Text>)>>' has no member 'slideOverCard'
- If I use
.sheet
, no error occurs. Why?
import SwiftUI
struct ContentView: View {
@State private var showCard = false
var body: some View {
HStack{
Text("Hello, world!")
.padding()
Button("abb"){
showCard = true
}
}
.sheet(isPresented: $showCard ) {
Text("Hello, world!")
// Here goes your awesome content
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
hey @sunshinewithmoonlight! tysm for using my Swift Package!
I think the problem with your code snippet is that you're not importing/adding the package to that file. so make sure to add an import SlideOverCard
at the top!
You are right, thanks for your reply!