Contents

About the Author

About the Techincal reviewer

Acknowledgments

Introduction

image Chapter 1: Understanding Programming

Programming Principles

Structured Programming

Event-Driven Programming

Object-Oriented Programming

Encapsulation

Inheritance

Polymorphism

Understanding Programming Languages

The Cocoa Framework

The View-Model-Controller Design

How Programmers Work

Summary

image Chapter 2: Getting to Know Xcode

Giving Commands to Xcode

Modifying the Xcode Window

Creating and Managing Files

Creating and Customizing a User Interface

The Standard and Assistant Editors

Running a Program

Summary

image Chapter 3: The Basics of Creating a Mac Program

Creating a Project

Designing a User Interface

Using the Document Outline and Connections Inspector

Summary

image Chapter 4: Getting Help

Understanding the Cocoa Framework

Looking Up Properties and Methods in a Class File

Looking Up Class Files with the Help Menu

Looking Up Class Files with Quick Help

Browsing the Documentation

Searching the Documentation

Using Code Completion

Understanding How OS X Programs Work

Summary

image Chapter 5: Learning Swift

Using Playgrounds

Creating Comments in Swift

Storing Data in Swift

Typealiases

Using Unicode Characters as Names

Converting Data Types

Computed Properties

Using Optional Variables

Linking Swift Code to a User Interface

Summary

image Chapter 6: Manipulating Numbers and Strings

Using Mathematical Operators

Prefix and Postfix Operators

Compound Assignment Operators

Using Math Functions

Rounding Functions

Calculation Functions

Trigonometry Functions

Exponential Functions

Logarithmic Functions

Using String Functions

Creating Functions

Simple Functions Without Parameters or Return Values

Simple Functions With Parameters

Functions With Parameters That Return Values

Defining External Parameter Names

Using Variable Parameters

Using Inout Parameters

Understanding IBAction Methods

Summary

image Chapter 7: Making Decisions with Branches

Understanding Comparison Operators

Understanding Logical Operators

The if Statement

The if-else Statement

The if-else if Statement

The switch Statement

Using the switch Statement with enum Data Structures

Making Decisions in an OS X Program

Summary

image Chapter 8: Repeating Code with Loops

The while Loop

The repeat-while Loop

The for Loop That Counts

The for-in Statement

Exiting Loops Prematurely

Using Loops in an OS X Program

Summary

image Chapter 9: Arrays and Dictionaries

Using Arrays

Adding Items to an Array

Deleting Items From an Array

Querying Arrays

Manipulating Arrays

Using Dictionaries

Adding Items to a Dictionary

Retrieving and Updating Data in a Dictionary

Deleting Data in a Dictionary

Querying a Dictionary

Using Dictionaries in an OS X Program

Summary

image Chapter 10: Tuples, Sets, and Structures

Using Tuples

Accessing Data in a Tuple

Using Sets

Creating a Set

Adding and Removing Items from a Set

Querying a Set

Manipulating Sets

Using Structures

Storing and Retrieving Items from a Structure

Using Structures in an OS X Program

Summary

image Chapter 11: Creating Classes and Objects

Creating Classes

Accessing Properties in an Object

Computed Properties in an Object

Setting Other Properties

Using Property Observers

Creating Methods

Using Objects in an OS X Program

Summary

image Chapter 12: Inheritance, Polymorphism, and Extending Classes

Understanding Inheritance

Understanding Polymorphism

Overriding Properties

Preventing Polymorphism

Using Extensions

Using Protocols

Defining Optional Methods and Properties in Protocols

Using Inheritance with Protocols

Using Delegates

Using Inheritance in an OS X Program

Summary

image Chapter 13: Creating a User Interface

Understanding User Interface Files

Searching the Object Library

User Interface Items That Display and Accept Text

User Interface Items That Restrict Choices

User Interface Items That Accept Commands

User Interface Items That Groups Items

Using Constraints in Auto Layout

Defining Window Sizes

Placing Constraints on User Interface Items

Editing Constraints

Defining Constraints in an OS X Program

Summary

image Chapter 14: Working with Views and Storyboards

Creating User Interface Files

Adding an .xib or .storyboard File

Defining the Main User Interface

Displaying Multiple .xib Files

Using Storyboards

Zooming In and Out of a Storyboard

Adding Scenes to a Storyboard

Defining the Initial Scene in a Storyboard

Connecting Scenes with Segues

Displaying Scenes From a Segue

Removing a Scene After a Segue

Passing Data Between Scenes

Summary

image Chapter 15: Choosing Commands with Buttons

Modifying Text on a Button

Adding Images and Sounds to a Button

Connecting Multiple User Interface Items to IBAction Methods

Working with Pop-Up Buttons

Modifying Pop-Up Menu Items Visually

Adding Pop-Up Menu Items with Swift Code

Summary

image Chapter 16: Making Choices with Radio Buttons, Check Boxes, Date Pickers, and Sliders

Using Check Boxes

Using Radio Buttons

Using a Date Picker

Using Sliders

Summary

image Chapter 17: Using Text with Labels, Text Fields, and Combo Boxes

Using Text Fields

Using a Number Formatter

Using a Secure Text Field, a Search Field, and a Token Field

Using Combo Boxes

Creating an Internal List

Using a Data Source

Summary

image Chapter 18: Using Alerts and Panels

Using Alerts

Getting Feedback from an Alert

Displaying Alerts as Sheets

Using Panels

Creating an Open Panel

Creating a Save Panel

Summary

image Chapter 19: Creating Pull-Down Menus

Editing Pull-Down Menus

Adding New Pull-Down Menu Titles to the Menu Bar

Adding New Commands to a Pull-Down Menu

Editing Commands

Connecting Menu Commands to Swift Code

Summary

image Chapter 20: Protocol-Oriented Programming

Understanding Protocols

Using Methods in Protocols

Adopting Multiple Protocols

Protocol Extensions

Using Protocol Extensions to Extend Common Data Types

Summary

image Chapter 21: Defensive Programming

Test with Extreme Values

Be Careful with Language Shortcuts

Working with Optional Variables

Working with Optional Chaining

Error Handling

Defining Errors with enum and ErrorType

Creating a Function to Identify Errors

Handling the Error

Summary

image Chapter 22: Simplifying User Interface Design

Using Stack View

Fixing Constraint Conflicts

Working with Storyboard References

Summary

image Chapter 23: Debugging Your Programs

Simple Debugging Techniques

Using the Xcode Debugger

Using Breakpoints

Stepping Through Code

Managing Breakpoints

Using Symbolic Breakpoints

Using Conditional Breakpoints

Troubleshooting Breakpoints in Xcode

Summary

image Chapter 24: Planning a Program Before and After Coding

Identifying the Purpose of Your Program

Designing the Structure of a Program

Designing the User Interface of a Program

Design a User Interface with Paper and Pencil

Design a User Interface with Software

Marketing Your Software

Blogging About Your Software

Giving Away Free Software

Posting Videos About Your Software

Give Away Free Information

Join Social Networks

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset