how do i get rid of this error

Initializer for conditional binding must have Optional type, not '()'

heres the code for some more context:

Code Block
@objc func shareTapped() {
    guard let share = print("Hey, checkout this new app I found, Its about storms and how they look!") else {
    print("no app link was found")
    return
  }

It is not clear enough what you want to do, but print does not return values, so trying to use it in guard-let has no meaning.

I guess you might want to do something like this:
Code Block
    var sharedUrl: URL?
    @objc func shareTapped() {
        if let share = sharedUrl {
            print("Hey, checkout this new app I found, Its about storms and how they look!")
            //Use `share`...
            print(share)
            //...
        } else {
            print("no app link was found")
        }
    }


If this is not what you expect, please show more context.
OOPer answer will do all you need.

With the same hypothesis, if you want to use guard, you should write:

Code Block
@objc func shareTapped() {
guard let share = sharedUrl else {
print("no app link was found")
return
}
print("Hey, checkout this new app I found, Its about storms and how they look!")
print(share)
}


how do i get rid of this error
 
 
Q