O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Xcode 7 Essentials - Second Edition

Book Description

Step up your iOS development with the power and wealth of features of Xcode 7

About This Book

  • Updated for the latest Xcode 7 release, this is the first book that will show you how to use all the new features available in Xcode 7 to their fullest
  • This guide to will get you up and running with the entire workflow to develop Apple apps without previous Xcode experience
  • Packed with plenty of tips on how to use Xcode with Swift 2 and other existing Apple frameworks to develop robust apps at a rapid pace

Who This Book Is For

If you are a novice programmer who is familiar with the concepts of object-oriented programming, but have little to no knowledge of Swift, Xcode, or Apple’s Cocoa APIs, then this book is for you. Starting with an introduction to the basics of Xcode and the Swift programming language, you will learn all of the skills that are essential to build an app and submit it to the App Store

What You Will Learn

  • Get an introduction to Xcode and get to know how to navigate and use the tool
  • Build playgrounds to learn and explore the environment
  • Create an adaptive UI with the interface builder that will help your app to scale through a wide range of devices
  • Understand Table, Collection, and Stack views and find out how they can be implemented
  • Create custom components for your application through frameworks and live previews
  • Exploit Xcode’s advanced features to elevate your debugging and testing capabilities
  • Run your application on the physical device and submit it to the App store

In Detail

Apple’s Xcode technology is making the development curve smoother than it has ever been with its easy-to-develop features and enhancements. With the latest release of Xcode 7, Apple has also added great support for Swift development.

This book will introduce you to all the new features of Xcode 7 and demonstrate how Swift programming can be much easier, faster, and simply better with Xcode!

Even if you’re starting with just a little knowledge of Swift or Xcode, you will learn the basics of the language as well as the tool. You will then use this knowledge to create simple applications and will learn how to debug and optimize your code. At the end of this book, you would have learned enough to build, run and submit your very own application to the App Store.

Style and approach

This is a step-by-step guide, full of practical and real world examples, to help you get to grips with Xcode with ease. A demo project is also provided at the end of the book, where you can test your skills.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Xcode 7 Essentials Second Edition
    1. Table of Contents
    2. Xcode 7 Essentials Second Edition
    3. Credits
    4. About the Authors
    5. About the Reviewer
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Introduction to Xcode
      1. Requirements and getting Xcode
      2. Features of Xcode
      3. What's new in Xcode 7?
        1. Sideloading
        2. Swift 2
        3. Playgrounds
        4. Testing
        5. Crash logs
      4. Summary
    9. 2. A tour of Xcode
      1. Starting Xcode
      2. Creating a new project
      3. Choosing a template
      4. Choosing the project options
      5. Setting the project properties
      6. Xcode overview
      7. The toolbar area
      8. The navigator area
      9. The editor area
        1. The Standard editor
        2. The Assistant editor
      10. The comparison editor
      11. The utilities area
      12. The debug area
      13. Development languages
      14. Summary
    10. 3. Playgrounds
      1. Before we start
      2. The storyboard workspace
      3. Learning Swift
      4. Working with constants and variables
        1. Value types
        2. Working with strings
        3. Working with numbers
        4. Working with Booleans
      5. Adding different types
      6. Collection types
        1. Array type
          1. Creating arrays
          2. Accessing items
          3. Modifying arrays
          4. Loops and iteration
        2. Dictionary type
          1. Creating dictionaries
          2. Accessing items
          3. Modifying items
          4. Loops and iteration
        3. Set type
          1. Creating sets
          2. Accessing, modifying, and iterating through a set
          3. Set operations
      7. The Any and AnyObject types
      8. Optionals
        1. Unwrapping optionals
          1. if let
          2. guard let
        2. Unwrapping multiple optionals
        3. Optional chaining
      9. Tuples
        1. Accessing items
      10. Conditional statements
        1. The if statement
        2. The switch statement
        3. The guard statement
      11. Loops
        1. For and for in
        2. While and repeat-while
        3. Breaking or continuing
      12. Functions and closures
        1. Returns
        2. Parameters
        3. Closures
      13. Classes and structures
        1. Classes versus structures
        2. Extending classes and structures
      14. Enumerations
      15. Error handling
        1. Propagating errors
        2. Handling errors, do-catch and try?
          1. do catch
        3. Try?
        4. Asserting errors
      16. Defer statements
      17. Summary
    11. 4. Interface Builder
      1. Model View Controller
      2. Understanding Interface Builder
        1. Views and View Controllers
        2. Adding elements to your view
      3. Adaptive UI
        1. Size Classes
        2. Auto Layout
          1. Debugging Auto Layout
          2. Tweaking values
          3. Pinning
          4. Relative positioning
      4. Adding more views
      5. Navigation controllers
      6. Connecting views and controllers
        1. Subclassing UIViewController
          1. Understanding subclassing
          2. Creating connections, outlets and actions
      7. Different elements in different Size Classes
        1. Layout previews
      8. Managing connections
      9. Adding gesture recognizers
      10. Summary
    12. 5. Table, Collection, and Stack Views
      1. Plain views versus Table, Collection, and Stack views
      2. Static table views
      3. Dynamic table views
        1. Data sources
        2. Delegates
        3. Bringing it all together
      4. Collection views
        1. Starting the example
        2. Creating a custom UICollectionViewCell
      5. Stack views
        1. What about OS X?
      6. Summary
    13. 6. Custom Controls
      1. Introducing Custom Controls
      2. The basics
        1. Starting an example project
        2. Creating a framework
        3. Creating a class
        4. Properties
      3. IBDesignable and IBInspectable
      4. Advanced drawing with CALayer
      5. Debugging Custom Controls
      6. Summary
    14. 7. Debugging
      1. Breakpoints
      2. Listing breakpoints
      3. The debug area
        1. The variables view
        2. The console area
      4. The debug navigator
      5. Quick Look
      6. Debugging the view hierarchy
      7. Dealing with crashes
      8. Summary
    15. 8. Testing Your Code
      1. Test-diven development
      2. Testing in Xcode
        1. The test navigator
        2. Test classes
        3. Test methods
          1. A simple calculator example
          2. Assertions
          3. Writing our first real functional unit test
          4. Performance tests
        4. UI tests
      3. Running tests and collecting results
        1. Code coverage
      4. Summary
    16. 9. Sideloading, Optimizing, and Submitting Your App
      1. iOS simulators
      2. Simulating different devices
        1. Simulator limitations
      3. Sideloading
        1. Getting an Apple ID
        2. Using an Apple ID with Xcode
        3. Registering a device
        4. The last steps
      4. Optimizing your app
        1. App thinning
          1. Slicing
          2. Bytecode
          3. On-demand resources
      5. Submitting your app to the App Store
        1. iTunes Connect
        2. Uploading a build
      6. Submitting your app for review
        1. App review
        2. App rejection
        3. Approval — ready for sale
      7. Summary
    17. A. Everything Else
      1. TestFlight
        1. Beta App review?
        2. Submitting your app
        3. Installing TestFlight builds
        4. Submitting for final sale
      2. Crash logs
      3. Storyboard references
        1. Creating a new Storyboard
        2. Refactoring existing views
      4. Summary
    18. Index