Swift for Absolute Beginners

Swift for Absolute Beginners

Language: English

Pages: 308

ISBN: 1484208870

Format: PDF / Kindle (mobi) / ePub


The professional development team that brought you two editions of Objective-C for the Absolute Beginners and have taught thousands of developers around the world to write some of the most popular iPhone apps in their categories on the app store, have now leveraged their instruction for Swift.

Swift for Absolute Beginners is perfect for those with no programming background, those with some programming experience but no object-oriented experience, or those that have a great idea for an app but haven’t programmed since school.

Gary Bennett and Brad Lees are full-time professional iOS developers and have developed a broad spectrum of apps for Fortune 500 companies. The authors have taken their combined 12 years of writing apps, teaching online iOS courses, the experience from their first two iOS books, along with their free online instruction and free online forum to create an excellent training book.

Topics include:

  • How to be successful at learning Swift
  • Using Swift Playgrounds to learn iOS development quickly
  • What is Object Oriented Programming
  • What are Swift classes, properties, and functions
  • Proper user interface and user experience design
  • Swift data types: integers, floats, strings, booleans
  • How to use Swift data collections: arrays and dictionaries
  • Boolean logic, comparing data, and flow control
  • Writing iPhone apps from scratch
  • Avoiding Swift pitfalls

Many students have a difficult time believing they can learn to write iOS apps or just staying motivated through learning the process. This book, along with the free, live online training sessions, helps students stay motivated and overcome obstacles while they learn to be great iOS developers.

Making Android Accessories with IOIO

Learn Mobile Game Development in One Day Using Gamesalad: Create Games for iOS, Android and Windows Phones and Tablets

Real-Time Analytics: Techniques to Analyze and Visualize Streaming Data

iOS 8 for Programmers: An App-Driven Approach with Swift (3rd Edition) (Deitel Developer Series)

iPhone Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides)

Moving To The Cloud: Developing Apps in the New World of Cloud Computing

 

 

 

 

 

 

 

 

 

 

 

.......................................................................................... xvii Acknowledgments ............................................................................................................. xix Introduction ....................................................................................................................... xxi N Chapter 1: Becoming a Great iOS Developer .....................................................................1 N Chapter 2:

28 29 30 31 32 33 import Foundation var var var var var randomNumber = 1 userGuess = 1 continueGuessing = true keepPlaying = true input = "" while (keepPlaying) { randomNumber = Int(arc4random_uniform(101)) //get a random number between 0-100 println("The random number to guess is: \(randomNumber)" ); while (continueGuessing) { println ("Pick a number between 0 and 100. ") input = NSString(data: NSFileHandle.fileHandleWithStandardInput(). availableData, encoding:NSUTF8StringEncoding)! //get

You now need to add the code to the file to actually create a class. In your Swift file, type the following: class Customer { } Figure 5-13. Your empty customer class 71 72 CHAPTER 5: Object-Oriented Programming with Swift This is all that is needed to create a Customer class. Note In Swift, a class does not need to be in its own file. Many classes can be defined in a single Swift file, but this can be difficult to maintain when your project contains a lot of classes. It is usually cleaner

that the parentheses are not followed by -> signifies that this function does not return any type of data and, if invoked, would not send a value to the caller. The end of line 1 and line 4 are the braces that define a block of code. This block is what defines the method. Every method has at least one block. CHAPTER 6: Learning Swift and Xcode 81 Line 2 creates a constant name of hello. As you learned in previous chapters, a constant is a value that cannot change or is constant. The value of

[String] = ["Two", "Three"] myArray.insert("One", atIndex:0) The array now contains One, Two, Three. Accessing items in an array is simple. You can use standard square brackets to access an object at a certain position. For example, myArray[0] would give you the first object in the array. If you want to loop through each of the items in the array, you can use something called fast enumeration. Listing 8-5 is an example of fast enumeration. Listing 8-5. Fast Enumeration 1 2 3 4 5 var myArray:

Download sample

Download