Book Image

Swift 2 Blueprints

By : Cecil Costa
Book Image

Swift 2 Blueprints

By: Cecil Costa

Overview of this book

In this book, you will work through seven different projects to get you hands-on with developing amazing applications for iOS devices. We start off with a project that teaches you how to build a utility app using Swift. Moving on, we cover the concepts behind developing an entertainment or social networking related application, for example, a small application that helps you to share images, audio, and video files from one device to another. You’ll also be guided through create a city information app with customized table views, a reminder app for the Apple Watch, and a game app using SpriteKit. By the end of this book, you will have the required skillset to develop various types of iOS applications with Swift that can run on different iOS devices. You will also be well versed with complex techniques that can be used to enhance the performance of your applications.
Table of Contents (15 chapters)
Swift 2 Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 posts the picture correctly, we will return to first screen by using the restart segue:

            fbViewController.completionHandler = {(result) -> Void in
                switch result {
                case...