Fayaz
Fayaz

Reputation: 47

Swift UI AsyncImage error - Cannot call value of non-function type 'module<AsyncImage>'

I am learning SwiftUI, from scratch and trying to show a Image from a URL, I am using the built in AsyncImage method, yet I get this error with no context. Cannot call value of non-function type 'module<AsyncImage>', Googling didn't help and I am following the exact same code line-by-line from a article I am following.enter image description here.

Here's some more details from the diagnostics popup, I received.

cannot call value of non-function type 'module'


SchemeBuildError: Failed to build the scheme "AsyncImage"

cannot call value of non-function type 'module'

Compile ContentView.swift (x86_64): /Users/fayaz/Learn/AsyncImage/AsyncImage/ContentView.swift:14:9: error: cannot call value of non-function type 'module' AsyncImage(url: URL(string: imageUrl)) ^

Here's my setup.

  1. Macos BigSur v11.0.1
  2. Xcode Version 12.5

Upvotes: 1

Views: 1019

Answers (1)

Alex Ioja-Yang
Alex Ioja-Yang

Reputation: 1533

Your project seems to be called AsyncImage, so without knowing all the other objects in your project its hard to know whether there would be some naming conflict.

However, your main issue is that AsyncImage is iOS 15+. That means currently, your version of Xcode (you said 12.5) doesn't support it. You would need to install Xcode 13 for the latest API. That would however require an Apple Developer account (can't remember whether the free version allows access to beta software though).

Upvotes: 3

Related Questions