0

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

1

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.