Languages Features Calendar About Lists Add Language
GitHub icon



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

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...

Try now: Riju Β· Replit

#17on PLDB 8Years Old 362.6kUsers

Example code from Riju:

print("Hello, world!")

Example code from hello-world:

print("Hello World")

Example code from the Hello World Collection:

// Hello world in Swift println("Hello, world!")

Example code from Linguist:

println("Hello, world")

Example code 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 Example Token
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
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"
Semantic Indentation Ο΄

Trending Swift repos on GitHub

repo stars description
Loop 478 "An automated insulin delivery app template for iOS built on LoopKit"
NetNewsWire 2174 RSS reader for macOS.
open-source-ios-apps 21111 πŸ“± Collaborative List of Open-Source iOS Apps
Brooklyn 2926 "🍎 Screensaver inspired by Apple's Event on October 30 2018"
XcodeGen 2618 A Swift command line tool for generating your Xcode project
firefox-ios 8877 Firefox for iOS
swifter 2776 Tiny http server engine written in Swift programming language.
FSPagerView 4633 FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders.
PhoneNumberKit 3094 "A Swift framework for parsing formatting and validating international phone numbers. Inspired by Google's libphonenumber."
Alamofire 31815 Elegant HTTP Networking in Swift
Aerial 15249 Apple TV Aerial Screensaver for Mac
RxSwift 17102 Reactive Programming in Swift
UICircularProgressRing 1198 A circular progress bar for iOS written in Swift
swift-log 1383 A Logging API for Swift
SQLite.swift 6327 "A type-safe Swift-language layer over SQLite3."
awesome-swift 17867 A collaborative list of awesome Swift libraries and resources. Feel free to contribute!
FloatingPanel 2768 A clean and easy-to-use floating panel UI component for iOS
CryptoSwift 7218 CryptoSwift is a growing collection of standard and secure cryptographic algorithms implemented in Swift
open-source-mac-os-apps 18202 πŸš€ Awesome list of open source applications for macOS.
Hero 17276 Elegant transition library for iOS & tvOS
Quick 8386 The Swift (and Objective-C) testing framework.
SwiftyUserDefaults 3871 Modern Swift API for NSUserDefaults
Gifski 3753 🌈 Convert videos to high-quality GIFs on your Mac
Dozer 2187 Hide status bar icons on macOS
PromiseKit 11928 Promises for Swift & ObjC.

Article source

PLDB - Build the next great programming language. v5.0.0 - Acknowledgements Β· Email Β· GitHub