Swift Quick Syntax Reference
()
About this ebook
Swift Quick Syntax Reference is a condensed code and syntax reference to the new Apple Swift programming language, which is the alternative new programming language alongside Objective-C behind the APIs found in the Apple iOS SDK 8 and OS X Yosemite SDK. It presents the essential Swift syntax in a well-organized format that can be used as a handy reference.
You won’t find any technical jargon, bloated samples, drawn out history lessons, or witty stories in this book. What you will find is a language reference that is concise, to the point, and highly accessible. The book is packed with useful information and is a must-have for any Swift programmer.
In the Swift Quick Syntax Reference, you will find a concise reference to the Swift language syntax using the new Playgrounds. Playgrounds lets you type a line of code and the result appears immediately.
Read more from Matthew Campbell
Learn RStudio IDE: Quick, Effective, and Productive Data Science Rating: 0 out of 5 stars0 ratingsSinister City Rating: 0 out of 5 stars0 ratings
Related to Swift Quick Syntax Reference
Related ebooks
Introducing Spring Framework: A Primer Rating: 0 out of 5 stars0 ratingsPro TypeScript: Application-Scale JavaScript Development Rating: 4 out of 5 stars4/5The Business of iOS App Development: For iPhone, iPad and iPod touch Rating: 0 out of 5 stars0 ratingsBeginning C++ Rating: 0 out of 5 stars0 ratingsLearn Java for Android Development: Java 8 and Android 5 Edition Rating: 0 out of 5 stars0 ratingsBeginning Hibernate Rating: 0 out of 5 stars0 ratingsVisual Studio Condensed: For Visual Studio 2013 Express, Professional, Premium and Ultimate Editions Rating: 0 out of 5 stars0 ratingsBeginning Haskell: A Project-Based Approach Rating: 0 out of 5 stars0 ratingsSoftware Engineering from Scratch: A Comprehensive Introduction Using Scala Rating: 0 out of 5 stars0 ratingsModern Front-end Architecture: Optimize Your Front-end Development with Components, Storybook, and Mise en Place Philosophy Rating: 0 out of 5 stars0 ratingsWeb Applications with Elm: Functional Programming for the Web Rating: 0 out of 5 stars0 ratingsSoftware Development From A to Z: A Deep Dive into all the Roles Involved in the Creation of Software Rating: 0 out of 5 stars0 ratings.NET DevOps for Azure: A Developer's Guide to DevOps Architecture the Right Way Rating: 0 out of 5 stars0 ratingsSwift 5 for Absolute Beginners: Learn to Develop Apps for iOS Rating: 0 out of 5 stars0 ratingsLearn C++ for Game Development Rating: 0 out of 5 stars0 ratingsASP.NET Web API 2: Building a REST Service from Start to Finish Rating: 4 out of 5 stars4/5Practical React Native: Build Two Full Projects and One Full Game using React Native Rating: 0 out of 5 stars0 ratingsObjective-C Memory Management Essentials Rating: 0 out of 5 stars0 ratingsFoundations of Python Network Programming Rating: 4 out of 5 stars4/5C# Deconstructed: Discover how C# works on the .NET Framework Rating: 0 out of 5 stars0 ratingsMastering The Spritekit Framework: Develop Professional Games With This New Ios 7 Framework Rating: 0 out of 5 stars0 ratingsAPI Development: A Practical Guide for Business Implementation Success Rating: 0 out of 5 stars0 ratingsMastering The Accounts and Social Framework: Social Media Integration Using These Ios7 Frameworks Rating: 0 out of 5 stars0 ratingsMastering The XMPP Framework: Develop XMPP Chat Applications for iOS Rating: 5 out of 5 stars5/5Application Development with Swift Rating: 0 out of 5 stars0 ratingsAdvanced API Security: Securing APIs with OAuth 2.0, OpenID Connect, JWS, and JWE Rating: 4 out of 5 stars4/5Learning Swift - Second Edition Rating: 0 out of 5 stars0 ratingsRubyMotion iOS Develoment Essentials Rating: 0 out of 5 stars0 ratingsThe Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript Rating: 0 out of 5 stars0 ratingsiOS Application Development with OpenCV 3 Rating: 0 out of 5 stars0 ratings
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5Java for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5The Little SAS Book: A Primer, Sixth Edition Rating: 5 out of 5 stars5/5Teach Yourself C++ Rating: 4 out of 5 stars4/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5
Reviews for Swift Quick Syntax Reference
0 ratings0 reviews
Book preview
Swift Quick Syntax Reference - Matthew Campbell
© Matthew Campbell 2014
Matthew CampbellSwift Quick Syntax Reference10.1007/978-1-4842-0439-9_1
1. Hello World
Matthew Campbell¹
(1)
New York, USA
I will start our conversation about Swift with the venerable Hello World program. However, you need to get some things in place before I can do that. Most importantly, you need a Mac app that will help you write and test Swift code. This Mac app is called Xcode.
Xcode
Xcode is a free app that you can download from the Apple App Store. Xcode gives you all the tools that you need to build applications for the Mac and iOS devices. These tools include a code editor, debugging tools, and everything else you need to turn your Swift code into an app.
Note
Xcode requires a Mac with OS X 10.9.3 or OS X 10.10. You cannot install Xcode on a Windows- or Linux-based computer.
Install Xcode
To install Xcode, go to the Mac App Store by selecting your Mac’s menu bar, clicking the Apple symbol, and then clicking App Store. Use the App Store search feature to locate Xcode by typing the word Xcode into the text box next to the hourglass. Press Return to search for Xcode. You will be presented with a list of apps, and Xcode should be the first app in the list. Install Xcode by clicking the button with the word free next to the Xcode icon. The word free changes to installed once it’s ready to go, as shown in Figure 1-1.
A978-1-4842-0439-9_1_Fig1_HTML.jpgFigure 1-1.
Downloading Xcode from the App Store
Note
Xcode version 6 is required to do Swift programming. By the time this book is released, Xcode 6 should be available in the Apple App Store, and you should be able to get it by following the previous instructions. However, at the time of this writing, Xcode 6 is still in beta and available only to registered Apple developers who can download it from the Apple developer web site at http://developer.apple.com .
Create a New Playground
Playgrounds are a workspace that you use to quickly prototype Swift code. The examples in this book will assume that you are using playgrounds to follow along. You use Xcode to make a playground.
Open Xcode by going to your Applications folder and clicking the Xcode app. You will be presented with a welcome screen. Click the text Get started with a playground
to build your playground (see Figure 1-2).
Figure 1-2.
Xcode welcome screen
You will be presented with a Save As screen, as shown in Figure 1-3. Use this screen to choose a name and location for your Swift playground.
A978-1-4842-0439-9_1_Fig3_HTML.jpgFigure 1-3.
Playground Save As screen
Once you choose your playground’s name and folder location, Xcode will present a code editor with some boilerplate code already filled in for you (see Figure