I am new to swift and am trying to build an app. I am receiving "Expected Declaration" error on Xcode when I type the following code.
.edgesIgnoringSafeArea(.bottom)
Please guide me on how to resolve it. Thanks
I am new to swift and am trying to build an app. I am receiving "Expected Declaration" error on Xcode when I type the following code.
.edgesIgnoringSafeArea(.bottom)
Please guide me on how to resolve it. Thanks
A declaration is one of the things listed in https://docs.swift.org/swift-book/ReferenceManual/Declarations.html
If the compiler is saying it's expecting a declaration, it means you have written something that isn't a declaration in some place in the code where only a declaration is allowed.
In your case .edgesIgnoringSafeArea is a method on SwiftUI View type, so it would only be valid to put that right after a SwiftUI view, not on its own. It might be because you have brackets in the wrong place.