Check whether an app is installed using Swift

Before reading this answer you must solemnly swear not to do any of the activities on the page you linked to. (Looking for dating apps? Seriously?)

The method is essentially the same:

if let appURL = NSURL(string: "myapp://test/url/") {
    let canOpen = UIApplication.sharedApplication().canOpenURL(appURL)
    println("Can open \"\(appURL)\": \(canOpen)")
}

let we take two app with name A and B.

Now i want to open app B from app A, so for that first create URLSchema in app B.

Than add below code to info.plist file in app A.

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>app b schema Name</string>
</array>

Now add below code to app A from where you want to open app B.

UIApplication.shared.canOpenURL(URL(string:"app b schema Name://")! as URL)

thank you.