Sharing on Social Media

First, when your app is completed, go to iTunes connect and create a new app.
Key in the needed info (remember that your bundle id and sku starts with com.... the one that you use to uniquely identify your app).
Go to the bottom and the page and look for 'View your app in App Store'. Click on it to get the URL of your app.

Add a button and add an onclick event with the following code:
let textToShare = "Join me in getting fit through dance!"
        
        if let myWebsite = NSURL(string: "https://itunes.apple.com/us/app/daily-dance-fitness/id1372552926?ls=1&mt=8") {
            let objectsToShare = [textToShare, myWebsite] as [Any]
            let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
             activityVC.excludedActivityTypes = [UIActivityType.airDrop, UIActivityType.addToReadingList]
            activityVC.popoverPresentationController?.sourceView = sender as? UIView
            self.present(activityVC, animated: true, completion: nil)

        }

Comments

Popular posts from this blog

Setting up a playground