Languages Features Creators Calendar CSV Resources Blog About Pricing Add Language
GitHub icon

Swift

Swift - Programming language

< >

Swift is a programming language created in 2014 by Chris Lattner.

#23on PLDB 9Years Old 362.6kUsers
125Books 19Papers 1mRepos

Try now: Riju · Replit

Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, macOS, watchOS, tvOS, and Linux. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C (ObjC) code written for Apple products. Read more on Wikipedia...


Example from Compiler Explorer:
// Type your code here, or load an example. func square(n: Int) -> Int { return n * n }
Example from Riju:
print("Hello, world!")
Example from hello-world:
print("Hello World")
// Hello world in Swift println("Hello, world!")
Example from Linguist:
println("Hello, world")
Example from Wikipedia:
var someSortOfPrintableObject: SupportsToString ... print(someSortOfPrintableObject.toString())

Keywords in Swift

associatedtype class deinit enum extension func import init inout internal let operator private protocol public static struct subscript typealias var break case continue default defer do else fallthrough for guard if in repeat return switch where while as catch dynamicType false is nil rethrows super self Self throw throws true try #column #file #function #line #available #column #else#elseif #endif #file #function #if #line #selector associativity convenience dynamic didSet final get infix indirect lazy left mutating none nonmutating optional override postfix precedence prefix Protocol required right set Type unowned weak willSet

Language features

Feature Supported Token Example
Binary Literals ✓
// 0b[01_]+
Integers ✓
// [0-9][0-9_]*
Floats ✓
// [0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|\.[0-9_]*|[eE][+\-]?[0-9_]+)
Hexadecimals ✓
// 0x[0-9a-fA-F_]+
Octals ✓
// 0o[0-7_]+
Conditionals ✓
Access Modifiers ✓
Switch Statements ✓
Exceptions ✓
Classes ✓
While Loops ✓
Booleans ✓ true false
Case Sensitivity ✓
MultiLine Comments ✓ /* */
/* A comment
*/
Print() Debugging ✓ print
Line Comments ✓ //
// A comment
Type Inference ✓
Operator Overloading ✓
Interfaces ✓
protocol MyProtocol {
init(parameter: Int)
var myVariable: Int { get set }
var myReadOnlyProperty: Int { get }
func myMethod()
func myMethodWithBody()
}
extension MyProtocol {
func myMethodWithBody() {
  // implementation goes here
  }
}
File Imports ✓
import UIKit
import UIKit.UITableViewController
let tvc = UITableViewController()
let vc = UIViewController()
let label = UILabel()
Comments ✓
Single Dispatch ✓
Strings ✓ "
"hello world"
Assignment ✓
let label = UILabel()
Case Insensitive Identifiers X
Semantic Indentation X
Variable Substitution Syntax X

Books about Swift from ISBNdb

title authors year publisher
Swift for Beginners: Develop and Design Pitre, Boisy G. 2014 Peachpit Press
Transitioning to Swift Gardner, Scott and Gardner, Scott 2014 Apress
Swift Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides) Mathias, Matthew and Gallagher, John 2016 Big Nerd Ranch Guides
Learn Swift by Building Applications: Explore Swift programming through iOS app development Atanasov, Emil 2018 Packt Publishing
Swift Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides) Mathias, Matthew and Gallagher, John 2015 Big Nerd Ranch Guides
Mastering Swift 5: Deep dive into the latest edition of the Swift programming language, 5th Edition Hoffman, Jon 2019 Packt Publishing
The Swift Apprentice: Beginning Programming with Swift 2 Clayton, Janie and Gallagher, Alexis and Galloway, Matt and Ganem, Eli and Kerber, Erik and Morrow, Ben 2015 Razeware LLC
Swift iOS 24-Hour Trainer Mishra, Abhishek 2016 Wrox
Mastering Swift 4 - Fourth Edition: An in-depth and comprehensive guide to modern programming techniques with Swift Hoffman, Jon 2017 Packt Publishing
Application Development with Swift Ghareeb, Hossam 2015 Packt Publishing
Swift Apprentice Third Edition: Beginning Programming with Swift 4 raywenderlich.com Team and Clayton, Janie and Gallagher, Alexis and Galloway, Matt and Morrow, Ben and Pupaza, Cosmin and van Impe, Steven 2017 Razeware LLC
Mastering Swift 2 Jon Hoffman 2015-11-04 Packt Publishing
iOS 13 Programming for Beginners: Get started with building iOS apps with Swift 5 and Xcode 11, 4th Edition Sahar, Ahmad and Clayton, Craig 2020 Packt Publishing
Beginning Swift Games Development for iOS Goodwill, James and Matlock, Wesley 2015 Apress
iOS 8 Swift Programming Cookbook: Solutions & Examples for iOS Apps Nahavandipoor, Vandad 2014 O'Reilly Media
macOS Programming for Absolute Beginners: Developing Apps Using Swift and Xcode Wang, Wallace 2017 Apress
Swift Protocol-Oriented Programming: Increase productivity and build faster applications with Swift 5, 4th Edition Hoffman, Jon 2019 Packt Publishing
Swift in the Cloud Williamson, Leigh and Ponzo, John and Bohrer, Patrick and Olivieri, Ricardo and Weinmeister, Karl and Kallner, Samuel 2017 Wiley
Learn Swift on the Mac: For OS X and iOS Malik, Waqar 2015 Apress
iOS Swift Game Development Cookbook: Simple Solutions for Game Development Problems Manning, Jonathon and Buttfield-Addison, Paris 2015 O'Reilly Media
Object Oriented Programming with Swift 2 Hillar, Gaston C. 2016 Packt Publishing
Mastering Swift 5.3: Upgrade your knowledge and become an expert in the latest version of the Swift programming language, 6th Edition Hoffman, Jon 2020 Packt Publishing
Swift High Performance Kostiantyn Koval 2015-11-06 Packt Publishing
Swift Data Structure and Algorithms Azar, Erik and Alebicto, Mario Eguiluz 2016 Packt Publishing
Hands-On Swift 5 Microservices Development Ralph Kuepper; Tanner Nelson 43892 Packt Publishing
Migrating to Swift from Flash and ActionScript Adams, Radoslava Leseva and Lesev, Hristo 2016 Apress
Beginning CareKit Development: Develop CareKit Applications Using Swift Baxter, Christopher 2016 Apress
Reactive Programming with Swift 4: Build asynchronous reactive applications with easy-to-maintain and clean code using RxSwift and Xcode 9 Singh, Navdeep 2018 Packt Publishing
Swift 5 for Absolute Beginners: Learn to Develop Apps for iOS Kaczmarek, Stefan and Lees, Brad and Bennett, Gary 2019 Apress
iOS Code Testing: Test-Driven Development and Behavior-Driven Development with Swift Mishra, Abhishek 2017 Apress
Swift 2 Blueprints Cecil Costa 2015-10-27 Packt Publishing
Swift Quick Syntax Reference Campbell, Matthew 2014 Apress
Swift iOS 24-Hour Trainer Abhishek Mishra 2016-01-06 Wiley Professional Development (P&T)
Migrating to Swift from Web Development Liao, Sean and Punak, Mark and Nemec, Anthony 2015 Apress
Swift Game Programming for Absolute Beginners Egges, Arjan 2015 Apress
Beginner's Guide to iOS 10 App Development Using Swift 3: Xcode, Swift and App Design Fundamentals Yamacli, Serhan 2016 CreateSpace Independent Publishing Platform
Swift iOS Programming for Kids: Help your kids build simple and engaging applications with Swift 3.0 Sommer, Steffen D. and Campagno, Jim 2017 Packt Publishing
Swift OS X Programming for Absolute Beginners Wang, Wallace 2015 Apress
Swift Programming: The Big Nerd Ranch Guide Mathias, Matthew (author.) 2015 Big Nerd Ranch, Exclusive Worldwide Distribution Of The English Edition Of This Book By Pearson Technology Group
Developing for Apple TV using tvOS and Swift Bennett, Gary and Lees, Brad and Kaczmarek, Stefan 2015 Apress
Build iOS Database Apps with Swift and SQLite Kevin Languedoc 20161115 Springer Nature
Learn Swift 2 on the Mac: For OS X and iOS Malik, Waqar 2015 Apress
Swift Apprentice (Seventh Edition): Beginning Programming with Swift Tutorial Team, raywenderlich and Ganim, Eli and Pupăză, Cosmin and Galloway, Matt and Morrow, Ben and Gallagher, Alexis and Amer, Ehab Yosry 2021 Razeware LLC
Combine: Asynchronous Programming with Swift (Third Edition) Tutorial Team, raywenderlich and Mishali, Shai and Pillet, Florent and Todorov, Marin and Gardner, Scott 2021 Razeware LLC
iOS 14 Programming for Beginners: Get started with building iOS apps with Swift 5.3 and Xcode 12, 5th Edition Sahar, Ahmad 2020-11-27T00:00:01Z Packt Publishing
Combine: Asynchronous Programming with Swift (Second Edition) Tutorial Team, raywenderlich and Gardner, Scott and Mishali, Shai and Pillet, Florent and Todorov, Marin 2021 Razeware LLC
iOS 15 Programming for Beginners: Kickstart your mobile app development journey by building iOS apps with Swift 5.5 and Xcode 13, 6th Edition Sahar, Ahmad 2021 Packt Publishing
Swift: The Complete Guide for Beginners,Intermediate and Advanced Detailed Strategies To Master Swift Programming Martin, MG 2019 Independently published
Mastering iOS 14 Programming: Build professional-grade iOS 14 applications with Swift 5.3 and Xcode 12.4, 4th Edition Alebicto, Mario Eguiluz and Barker, Chris and Wals, Donny 2021 Packt Publishing
Swift Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides) Ward, Mikey 2020 Big Nerd Ranch Guides
Swift Apprentice (Fifth Edition): Beginning Programming with Swift Tutorial Team, raywenderlich and Amer, Ehab and Gallagher, Alexis and Galloway, Matt and Ganim, Eli and Morrow, Ben and Pupaza, Cosmin 2019-11-25T00:00:01Z Razeware LLC
Beginning iPhone Development with Swift 5: Exploring the iOS SDK Wang, Wallace 2019 Apress
Swift Game Development: Learn iOS 12 game development using SpriteKit, SceneKit and ARKit 2.0, 3rd Edition Shekar, Siddharth and Haney, Stephen 2018 Packt Publishing
Pro iPhone Development with Swift 5: Design and Manage Top Quality Apps Wang, Wallace 2019 Apress
Data Structures & Algorithms in Swift (Fourth Edition): Implementing Practical Data Structures with Swift Tutorial Team, raywenderlich and Lau, Kelvin and Ngo, Vincent 2021 Razeware LLC
Beginning Xcode: Swift Edition Knott, Matthew 2014 Apress
Metal Programming Guide: Tutorial and Reference via Swift Clayton, Janie 2017-12-26T00:00:01Z Addison-Wesley Professional
iOS 15 Application Development for Beginners: Learn Swift Programming and Build iPhone Apps with SwiftUI and Xcode 13 (English Edition) Kulsreshtha, Arpit 2021 BPB Publications
Combine: Asynchronous Programming with Swift (First Edition) Tutorial Team, raywenderlich and Gardner, Scott and Mishali, Shai and Pillet, Florent and Todorov, Marin 2019-12-05T00:00:01Z Razeware LLC
Data Structures & Algorithms in Swift (Third Edition): Implementing Practical Data Structures with Swift Tutorial Team, raywenderlich and Lau, Kelvin and Ngo, Vincent 2019 Razeware LLC
iOS 13 Programming for Beginners: Get started with building iOS apps with Swift 5 and Xcode 11, 4th Edition Sahar, Ahmad and Clayton, Craig 2020 Packt Publishing
Beginning iPhone Development with Swift 4: Exploring the iOS SDK Maskrey, Molly K. 2017 Apress
Swift Cookbook: Over 60 proven recipes for developing better iOS applications with Swift 5.3, 2nd Edition Moon, Keith and Barker, Chris 2021 Packt Publishing
Hands-On Full-Stack Development with Swift: Develop full-stack web and native mobile applications using Swift and Vapor Patel, Ankur 2018 Packt Publishing
Swift Programming in easy steps: Develop iOS apps - covers iOS 12 and Swift 5 Bartlett, Darryl 2019-06-25T00:00:01Z In Easy Steps Limited
RxSwift: Reactive Programming with Swift raywenderlich.com Team and Pillet, Florent and Bontognali, Junior and Todorov, Marin and Gardner, Scott 2017 Razeware LLC
Beginner’s Guide to iOS 13 App Development Using Swift 5.1: Xcode, Swift and App Design Fundamentals Yamacli, Serhan 2019 Independently published
macOS Programming for Absolute Beginners: Developing Apps Using Swift and Xcode Wang, Wallace 2017 Apress
Learn SwiftUI: An introductory guide to creating intuitive cross-platform user interfaces using Swift 5 Barker, Chris 2020 Packt Publishing
Swift for Beginners: Develop and Design Pitre, Boisy G. 2015 Peachpit Press
iOS 13 & Swift 5 Programming Wahlbeck, Mark 2019-12-14T00:00:01Z Devslopes
Swift for Programmers (Deitel Developer Series) Deitel, Paul J. and Deitel, Harvey 2015-02-01T00:00:01Z Prentice Hall
Learn Computer Science with Swift: Computation Concepts, Programming Paradigms, Data Management, and Modern Component Architectures with Swift and Playgrounds Feiler, Jesse 2017 Apress
Swift iOS Programming for Kids Sommer, Steffen D. and Campagno, Jim 2017-03-22T00:00:01Z Packt Publishing
Beginning Swift: Master the fundamentals of programming in Swift 4 Kerr, Rob and Morstol, Kare 2018-05-31T00:00:01Z Packt Publishing
Test-Driven iOS Development with Swift Hauser, Dr. Dominik 2016 Packt Publishing
Swift Pocket Reference Gray, Anthony 2015 O'Reilly Media
Swift Functional Programming - Second Edition: Ease the creation, testing, and maintenance of Swift codes Nayebi, Dr. Fatih 2017 Packt Publishing
Swift Data Structure and Algorithms Azar, Erik and Alebicto, Mario Eguiluz 2016 Packt Publishing
iOS and macOS Performance Tuning: Cocoa, Cocoa Touch, Objective-C, and Swift (Developer's Library) Weiher, Marcel 2017 Addison-Wesley Professional
Swift 4 Protocol-Oriented Programming: Bring predictability, performance, and productivity to your Swift applications, 3rd Edition Hoffman, Jon 2017 Packt Publishing
Test-Driven iOS Development with Swift Hauser, Dr. Dominik 2016 Packt Publishing
iOS 12 Programming for Beginners: An introductory guide to iOS app development with Swift 4.2 and Xcode 10, 3rd Edition Clayton, Craig 2018 Packt Publishing
Functional Programming: A PragPub Anthology: Exploring Clojure, Elixir, Haskell, Scala, and Swift 2017-08-08T00:00:01Z Pragmatic Bookshelf
The Swift Apprentice Second Edition: Beginning programming with Swift 3 raywenderlich.com Team and Clayton, Janie and Gallagher, Alexis and Galloway, Matt and Ganem, Eli and Kerber, Erik and Morrow, Ben and Pupaza, Cosmin and Van Impe, Steven 2016-12-07T00:00:01Z Razeware LLC
Swift 4 Programming Cookbook: 50 task-oriented recipes to make you productive with Swift 4 Moon, Keith 2017 Packt Publishing
Swift Cookbook - 50 Recipes to Help You Harness Swift Costa, Cecil 2015 Packt Publishing
Game Development with Swift: Embrace the mobile gaming revolution and bring your iPhone game ideas to life with Swift Haney, Stephen 2015 Packt Publishing
Swift 2 By Example Scalzo, Giordano 2016 Packt Publishing
iOS 11 Swift Programming Cookbook: Solutions and Examples for iOS Apps Nahavandipoor, Vandad 2018-01-09T00:00:01Z O'Reilly Media
Swift Pocket Reference: Programming for Ios and OS X: Covers Swift 2.1 Gray, Anthony 2015-12-15T00:00:01Z O'Reilly Media
Pro Design Patterns in Swift Freeman, Adam 2015 Apress
Beginning Swift Programming Lee, Wei-Meng 2014 Wrox
Introduction to Algorithms and Data Structures in Swift 4: Get ready for programming job interviews. Write better, faster Swift code. (Swift Clinic) Nyisztor, Karoly 2018 Independently published
iOS 10 Swift Programming Cookbook: Solutions and Examples for iOS Apps Nahavandipoor, Vandad 2016 O'Reilly Media
Pro Design Patterns in Swift Freeman, Adam 2015 Apress
Programming in Swift (Developer's Library) Kochan, Stephen G. and Mick, Patrick 2021 Addison-Wesley Professional
Swift OS X Programming for Absolute Beginners Wang, Wallace 2015 Apress
Swift 4 Protocol-Oriented Programming: Bring predictability, performance, and productivity to your Swift applications, 3rd Edition Hoffman, Jon 2017 Packt Publishing
Swift Functional Programming - Second Edition: Ease the creation, testing, and maintenance of Swift codes Nayebi, Dr. Fatih 2017 Packt Publishing
Mastering Swift 3 Hoffman, Jon 2016 Packt Publishing
Mastering Swift 3 - Linux Hoffman, Jon 2017 Packt Publishing
Learning Swift Wagner, Andrew 2015 Packt Publishing
Bluetooth Low Energy in iOS Swift (Kindle Edition): Your Guide to Programming the Internet of Things (Bluetooth Low Energy Programming Book 1) Gaitatzis, Tony 2017 BackupBrain
Swift 2 Design Patterns Lange, Julien 2015 Packt Publishing
Learn iOS 11 Programming with Swift 4 - Second Edition: Learn the fundamentals of iOS app development with Swift 4 and Xcode 9 Clayton, Craig 2018-01-31T00:00:01Z Packt Publishing
Swift 2 By Example Scalzo, Giordano 2016 Packt Publishing
Swift Translation Guide for Objective-C: Develop and Design Kelly, Maurice 2014 Peachpit Press
Learning Swift 2 Programming (2nd Edition) Schatz, Jacob 2016 Addison-Wesley Professional
Understanding Swift Programming Will, Craig A. 2015-09-11T00:00:01Z Tenaya Creek Press
Mastering iOS 12 Programming: Build professional-grade iOS applications with Swift and Xcode 10, 3rd Edition Wals, Donny 2018-10-31T00:00:01Z Packt Publishing
Beginning iPhone Development with Swift 2: Exploring the iOS SDK Mark, David and Topley, Kim and Nutting, Jack and Olsson, Fredrik and LAMARCHE, JEFF 2015 Apress
OS X App Development with CloudKit and Swift Wade, Bruce 2016 Apress
iOS 9 Swift Programming Cookbook: Solutions and Examples for iOS Apps Nahavandipoor, Vandad 2016-01-19T00:00:01Z O'Reilly Media
Program the Internet of Things with Swift for iOS Bakir, Ahmed and de la Torriente, Manny and Chesler, Gheorghe 2015 Apress
Swift Game Programming for Absolute Beginners Egges, Arjan 2015 Apress
Mastering iOS 11 Programming: Build professional-grade iOS applications with Swift 4 and Xcode 9, 2nd Edition Wals, Donny 2017 Packt Publishing
Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit Goodwill, James and Matlock, Wesley 2017 Apress
Swift 3 New Features Elliott, Keith 2016 Packt Publishing
Beginning Swift Games Development for iOS Goodwill, James and Matlock, Wesley 2015 Apress
Learning Swift Programming (Addison-Wesley Learning) Schatz, Jacob 2015 Addison-Wesley Professional
Transitioning to Swift Gardner, Scott 2014 Apress
The Swift Apprentice: Updated for Swift 2.2: Beginning Programming with Swift 2.2 raywenderlich.com Team and Clayton, Janie and Gallagher, Alexis and Galloway, Matt and Ganem, Eli and Kerber, Erik and Morrow, Ben 2016 Razeware LLC
Introducing iOS 8: Swift Programming from Idea to App Store Derico, Steve 2014 O'Reilly Media
Pro iPhone Development with Swift 4: Design and Manage Top Quality Apps Maskrey, Molly and Wang, Wallace 2018 Apress

Publications about Swift from Semantic Scholar

title authors year citations influentialCitations
The Swift Programming Language James Goodwill and Wesley Matlock 2015 46 4
An Empirical Study on the Usage of the Swift Programming Language Marcel Rebouças and G. Pinto and Felipe Ebert and Weslley Torres and Alexander Serebrenik and F. C. Filho 2016 23 0
How Swift Developers Handle Errors Nathan Cassee and G. Pinto and F. C. Filho and Alexander Serebrenik 2018 15 0
Swift vs. Objective-C: A New Programming Language Cristian González García and Jordán Pascual Espada and B. C. P. García-Bustelo and J. M. C. Lovelle 2015 12 0
Visualizing Swift Projects as Cities Rafael Nunes and Marcel Rebouças and Francisco Soares-Neto and F. C. Filho 2017 5 0
SWAN: a static analysis framework for swift Daniil Tiganov and Jeff Cho and Karim Ali and Julian Dolby 2020 5 0
Dynamic atomicity: optimizing swift memory management D. Ungar and D. Grove and H. Franke 2017 4 1
Using Nion Swift for Data Collection, Analysis and Display C. Meyer and N. Dellby and Z. Dellby and T. Lovejoy and M. Sarahan and G. Skone and O. Krivanek 2014 3 0
Beginning Swift Games Development for iOS James Goodwill and Wesley Matlock 2015 3 0
Optimization of swift protocols R. Barik and Manu Sridharan and M. Ramanathan and Milind Chabbi 2019 2 0
Trans-Compiler based Mobile Applications code converter: swift to java Ahmad A. Muhammad and Amira G. Mahmoud and Shaymaa S. Elkalyouby and Rameez B. Hamza and A. Yousef 2020 2 0
An SKOS-Based Vocabulary on the Swift Programming Language Christian Grévisse and S. Rothkugel 2020 2 0
EL FUTURO DE APPLE: SWIFT VERSUS OBJECTIVE-C Cristian González García and B. J. P. Espada and Cristina Pelayo G-Bustelo and J. M. C. Lovelle 2015 1 0
A Swift Introduction to Swift App Development (Abstract Only) Michael P. Rogers and W. Siever 2015 1 0
An Introduction to Swift Molly K. Maskrey and Kim Topley and David Mark and Fredrik Olsson and Jeff LaMarche 2016 1 0
Program the Internet of Things with Swift for iOS A. Bakir and Gheorghe Chesler and Manny de la Torriente 2015 1 0
Introducing Automatic Time Stamping (ATS) with a Reference Implementation in Swift Sean Hamilton and Dhiman Sengupta and Rajesh E. Gupta 2018 1 0
The Swift Language A. Egges 2015 1 0
Promotion of Educational Effectiveness by Translation-based Programming Language Learning Using Java and Swift Juhua Li and Kazunori Sakamoto and H. Washizaki and Y. Fukazawa 2017 1 0
ada.html · swift.html · postgresql.html

View source

- Build the next great programming language · Search · v2023 · Day 205 · Docs · Acknowledgements · Traffic · Traffic Today · Mirrors · GitHub · feedback@pldb.com