0

Hi I making a basic game and I want to be able to post the users highscore on Facebook along with presets words so all the user has to do is click the post button. So basically all I need is "My highscore is xxx". i have it posting on Facebook but can't seem to put the words in with the highscore xxx.

SharetoFacebook.setInitialText("My highscore is" + finalTime.text)

where final time is a label. if i take out the "My highscore is" it will post the highscore. And if i take out the finalTime.text it will only post the words. How do I combine these together in swift?

3 Answers3

0
SharetoFacebook.setInitialText("My highscore is + \(finalTime.text)")

Fairly simple syntax learning curve.

There ya go.

impression7vx
  • 1,728
  • 1
  • 20
  • 50
0
SharetoFacebook.setInitialText("My highscore is /(finalTime.text!)")

You can add a variable to a string by writing /() with the variable name inside.

Loanb222
  • 841
  • 1
  • 11
  • 29
0

You can't set the initial text for Facebook due to their terms, but you can add a link that will appear when the user presses the share to Facebook button. If you really need to set the initial text, use Twitter or email. Hope this helps!

Scott B.
  • 75
  • 7