Member Avatar for Member #1119206

I have couple of errors with creating and callng functions.pls have a look.I am using swift for coding.
[img]http://i.imgur.com/OVARWui.png[/img]

Dani AI

Generated

Short summary and clarification (follow-up to ): the Xcode error "use of unresolved identifier" means the Swift compiler cannot find a declaration with that name in the current scope — calling a function before its body is one possible cause, but far more common are scoping, target/import, or IDE-indexing problems. (stackoverflow.com)

Quick checklist to narrow the problem:

  • Check spelling and case (Swift is case-sensitive).
  • Confirm the symbol is actually in scope (not accidentally outside the class/struct because of a misplaced } or declared inside a different scope). A stray brace often produces this exact error. (stackoverflow.com)
  • If the symbol lives in another file or module, confirm import, target membership and access level (public/internal) are correct. Missing target membership or imports is a frequent cause. (stackoverflow.com)
  • If it’s a method on a type, make sure it’s called on an instance or declared static/class if calling on the type itself. For nested types, qualify with the enclosing type (for example Outer.Inner). (swift.bootcss.com)

Small examples (common fixes):

class Foo {
  func sayHi() { print("hi") }
}

// wrong:
sayHi()          // use of unresolved identifier

// correct:
let f = Foo()
f.sayHi()

// or make it a type method:
class Foo {
  static func sayHi() { print("hi") }
}
Foo.sayHi()

Practical debugging steps: reduce the file to a minimal reproducer (comment out other code), clean the build and DerivedData, and restart Xcode — SourceKit/Xcode indexing can show spurious unresolved-identifier errors that go away after a clean or restart. If the problem persists, post the minimal code (single file) showing the declaration and the call. (stackoverflow.com)

Seems pretty clear to me. You are calling functions that have not been defined as yet. A declaration is NOT a definition! You cannot call a function before it has been fully defined.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.