Publishing your picture
Now that you are able to edit the photo, we must develop the last part of the app. Connect the button at the bottom to an action called done
:
@IBAction func done(sender: UIButton) {
Here, you have to check whether the user is able to post via Facebook. He may have not logged in. If he is able to post it, you can create a view controller for posting. You can then attach your picture to the view controller:
if SLComposeViewController.isAvailableForServiceType(SLServiceTypeFacebook) { let fbViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook) fbViewController.addImage(boardView.getImage())
Now, we can set the operation that will be done when the user finishes with his post. In this case, if the user ...
Get Swift 2 Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.