Example code does not compile
arbyruns opened this issue · 6 comments
arbyruns commented
I get the following errors when attempting to compile.
- Argument passed to call that takes no arguments
- Type 'SafariView' has no member 'Configuration'
- Cannot infer contextual base in reference to member 'systemBlue'
- Cannot infer contextual base in reference to member 'done'
I'm running:
- Apple Swift version 5.2.4
Xcode: 11.7
import SwiftUI
import BetterSafariView
struct SafariView: View {
@State private var presentingSafariView = false
var body: some View {
Button(action: {
self.presentingSafariView = true
}) {
Text("Present SafariView")
}
.safariView(isPresented: $presentingSafariView) {
SafariView(
url: URL(string: "https://github.com/")!,
configuration: SafariView.Configuration(
entersReaderIfAvailable: false,
barCollapsingEnabled: true
)
)
.preferredControlTintColor(.systemBlue)
.dismissButtonStyle(.done)
}
}
}
struct SafariView_Previews: PreviewProvider {
static var previews: some View {
SafariView()
}
}
stleamist commented
Hi @rbevans-ugh,
It's because SafariView
that you implemented is passing itself recursively. Your View
name should not be the SafariView
, as it is used by BetterSafariView.
Change struct SafariView
to any other name, then it should work. 😁
arbyruns commented
stleamist commented
Hmm, could you try cleaning build folder by pressing shift-command-K and run again?
arbyruns commented
I tried that as well as restarting. Let me try a new project.
arbyruns commented
Seems to be something within my project since creating a new project the issue is resolved. Thanks for the help!
stleamist commented
Glad to hear that!