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 posts the picture correctly, we will return to first screen by using the restart
segue:
fbViewController.completionHandler = {(result) -> Void in switch result { case...