I'm making a SpriteKit based-app, and I have a spriteNode that shares to facebook when I tap it. This is the code that runs when it is tapped:
func shareToFacebook(){
var shareToFacebook: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
shareToFacebook.setInitialText("I just got x points in ....")
shareToFacebook.addImage(UIImage(named: "AppLogo87.png"))
let vc: UIViewController = self.view!.window!.rootViewController!
vc.presentViewController(shareToFacebook, animated: true, completion: nil)
}
I also have a score system set up within the game. What I want to do is display the score in the setInitialText message. I want it to say "I just got ___ points in app". I can't figure out how to add the player's score to the message.
I've read this twice and feel like I'm missing something, however if you are really just asking how to include a variable in text output then:
var scoreVar = object.getPoints()
var appName = object.getAppName()
shareToFacebook.setInitialText("I just got \(scoreVar) points in \(appName)")
If you're asking something else, then you'll have to be clearer (at least for me!).