ebook img

Computer Programming Guide: Swift and SQL: Create an APP PDF

216 Pages·2016·0.74 MB·English
by  Swift
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Computer Programming Guide: Swift and SQL: Create an APP

Swift Programming Guide Create a Fully Functioning App in a Day 2nd Edition by Os Swift © Copyright 2015 - All rights reserved. In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved. The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly. Respective authors own all copyrights not held by the publisher. Legal Notice: This book is copyright protected. This is only for personal use. You cannot amend, distribute, sell, use, quote or paraphrase any part or the content within this book without the consent of the author or copyright owner. Legal action will be pursued if this is breached. Disclaimer Notice: Please note the information contained within this document is for educational and entertainment purposes only. Every attempt has been made to provide accurate, up to date and reliable complete information. No warranties of any kind are expressed or implied. Readers acknowledge that the author is not engaging in the rendering of legal, financial, medical or professional advice. By reading this document, the reader agrees that under no circumstances are we responsible for any losses, direct or indirect, which are incurred as a result of the use of information contained within this document, including, but not limited to, —errors, omissions, or inaccuracies. Contents Introduction Chapter 1: A Basic Comparison of Swift and Objective C Code Comments Declaring Constants and Variables Variable Names and Unicode Integer Bounds Type Inference String Comparison String Upper or Lower Case Declaring Arrays Working with Arrays Declaring Dictionaries Working with Dictionaries For Loops Conditional Statements Switch Statement Functions Chapter 2: Introduction to Playgrounds Variables vs. Constants Explicit vs. Inferred Typing Basic Types and Control Flow in Swift Floats and Doubles: Bools Strings If Statements and String Interpolation Part 2: Using the Xcode Editing Tools Chapter 3: Classes and Methods Chapter 4: Arrays and For Loops Dictionaries Chapter 5: Creating Your First iOS App Getting Started Creating Your Model Chapter 6: Introduction to Storyboards and Interface Builder Creating your Views A View Controller Tour Connecting your View Controller to your Views Connecting Actions to your View Controller Connecting Your View Controller to your Model Chapter 7: Writing an iOS App with Swift – Advanced What You Need Getting Started Learning by Example AppDelegate.swift MasterViewController.swift DetailViewController.swift Coming Up Next Your First Feature Setting up The Storyboard Creating the AddTaskViewController Cancelling Task Creation Saving Your Task Creating the Task struct Managing our TaskStore Finishing Your First Feature How it Should Look Now Finishing off Save Using What You Have Got Opening the Detail Screen No more AnyObject Changing the Data Source and Delegate Back to the Data Source Finishing the Basics with the Delegate One More Method for TaskStore Tidying Things Up a Bit Altering the Storyboard Updating Your MasterViewController Redesigning the Detail View Displaying Your Notes Chapter 8: What’s New in Swift 2 Error Handling Binding Protocol Extensions Grab Bag Conclusion Sign up for FREE computer training and ebooks! http://freecomputertraining.strikingly.com Introduction In 2014, Apple changed their programming language, introducing Swift to build on the very best features of C and Objective-C without all the constraints of C Compatibility. Swift has been in the making for many years and brings new safe patterns of programming to the table, along with modern features that make it easy to program, far more flexible than ever before and a lot more fun to use. Swift will probably look and feel very familiar to old hands at Objective-C. That’s because it takes on the readability of named parameters and the power of the object model within Objective –C. And it brings a lot of new features the computer programming for iOS and OS X operating systems. Swift is incredibly user-friendly and is perfect for new programmers to learn. Included is support for playgrounds, which is an innovative new feature that lets you experiment with your code, see it running and see the results before you go to all the expense of building your app and running it. It combines modern language with wisdom garnered from the wide culture of Apple engineering. The compiler is fully performance optimized and the language is development optimized without any compromises. It is designed to go from the simple “Hello, World!” app right through to building a complete operating system and this is what makes it the language to learn, the best investment you could ever make for the future. Just like everything else they produce, Apple will ensure that Swift is kept fully updated with the latest features and the best capabilities. The idea of this book is to give you an overview of what Swift does now and help you to create your very first iOS/OS X app in the form of a Tips Calculator. If you are ready to start learning the computer language of the future, head on to the very first chapter and let’s see what you can do. Please be sure that you have the very latest version of Xcode before you begin – you can get it from the Mac OS X store – as we are going to delve straight into programming. Chapter 1: A Basic Comparison of Swift and Objective C Many of you are probably very familiar with Objective C programming language and may be wondering what, if any, differences there are between that and Swift. Sift is a recent and modern programming language that has all the power for Objective C but doesn’t have all the baggage that the older language comes with. So, before we get stuck into learning how to use Swift, I wanted to just give you a basic comparison of the two languages. This is NOT designed to be a “them and us” between Microsoft and Apple – there are many programmers who use C on a daily basis and I want to show you what Swift can offer compared to C. So, let the code start talking. Code Comments Both Swift and C support the same comments syntax – the all too familiar C comment: // code comment /* multi line code comment */ Declaring Constants and Variables Like C, Swift is a very type safe language. Swift also support type inference so, when you are declaring the variables, you do not need to specify the type as the computer will detect, or infer, the type. It does this by evaluating the variable assignment. C is a little more on the verbose side when it comes to declaring constants but both C and Swift are as elegant as one anther when it comes to using type inference to declare variables: // Declare Constant // C# const int legalAge = 18; // Swift let legalAge = 18 // Declare Variable // C# var legalAge = 18; // Swift var legalAge = 18 Type inference is all very nice but if you do not need to assign a value to a variable straightaway, you might have to explicitly specify the variable type: // Type Annotation //C# string firstName; // Swift

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.