Url(String:) Cannot Call Value of Non-Function Type 'string'

Cannot call value of non-function type 'String'

The error is telling you that you are trying to call a String instead of a method (struct constructor in your case). You've probably declared a String variable named ILT (uppercase) somewhere else and that's why it fails.

Your posted code works fine so the error must be somewhere else in your code.

Cannot call value of non-function type 'SwipeCard' in the function error in Swift

you have to remove let card = SwipeCard() and leaving just the following function:

func card(fromImage image: UIImage) -> SwipeCard {
let card = SwipeCard()
card.swipeDirections = [.left, .right]
card.content = UIImageView(image: image)
let leftOverlay = UIView()
leftoverlay.backgroundColor = .green
let rightOverlay = UIView()
rightOverlay.backgroundColor = .red
card.setOverlays([.left: leftOverlay, .right: rightOverlay])
return card
}

which is basically the one you call inside

 func cardStack(_ cardStack: SwipeCardStack, cardForIndexAt index: Int) -> SwipeCard

The error is telling you that you are trying to call a SwipeCard instance instead of a method.

I think you are referring to the constant let card rather than the function inside the above function.

Swift 3: Cannot call value of non function type 'Bundle'

Syntax is bit changed in Swift 3, it is main not mainBundle() and URLForResource is changed to url(forResource:withExtension:) also the init of NSManagedObjectModel is changed to init?(contentsOf:) from init?(contentsOfURL:)

lazy var managedObjectModel: NSManagedObjectModel = {
let modelURL = Bundle.main.url(forResource: "VerseApp", withExtension: "momd")!
print(modelURL)
return NSManagedObjectModel(contentsOf: modelURL)!
}()

Swift UI AsyncImage error - Cannot call value of non-function type 'moduleAsyncImage'

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).



Related Topics



Leave a reply



Submit