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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

example, the teenager has to clean his or her room AND have the dishes done. If either one of the conditions is FALSE, the result is FALSE—no movies for the teenager. For an OR operation to yield a TRUE result, only one operand has to be TRUE, or both conditions can be TRUE to yield a TRUE result. In the second example, just a clean bedroom would result in the ability to go to the movies. Note In Objective-C and other programming languages, Boolean variables can hold integer variables; 0

concern—this helps to analyze problems and possible solutions before coding begins. Pseudocode Pseudocode refers to writing code that is a high-level description of an algorithm you are trying to solve. Pseudocode does not contain the necessary programming syntax for coding; however, it does express the algorithm that is necessary to solve the problem at hand. Pseudocode can be written by hand on paper (or a whiteboard) or typed on a computer. Using pseudocode, you can apply what you know about

you to interact with a running app, so you are not able to capture keyboard input. Note You can download the complete random number generator app at http://forum.xcelme.com. The code is in the Chapter 4 topic. Your Swift app will run from the command line because it asks the user to guess a random number. 1. Open Xcode and start a new project. Choose the Command Line Tool project. See Figure 4-3. 52 CHAPTER 4: Making Decisions, Program Flow, and App Design Figure 4-3. Starting a new

the Label object on the interface to be smaller in width. How does that affect your text message? Delete the referencing outlet connection of the Label and rerun the project. What happens? If you think you have the hang of this, add a new Button and Label both to the ViewController object and to the interface. Change the Label from displaying your name to displaying something else. 99 Chapter 7 Swift Classes, Objects, and Methods If you haven’t already read Chapter 6, please do so before

first convert the double value (the station’s frequency) to an NSString. The @"%.1f means that you convert a floating-point value and should see only one digit after the decimal point. Lines 41 to 45 make use of both the instance variables and the class methods of the RadioStation class. Here, you simply check to see whether the frequency of the radio station is between minFMFrequency and maxFMFrequency. If so, the station is an FM station; otherwise, assume it’s the AM band. Lines 8 and 10 will

Download sample

Download