411 REFERENCE · Wikibooks
Programming Fundamentals/Introduction Examples Swift
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Overview
Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, macOS, watchOS, tvOS, and Linux. Apple intended Swift to support many core concepts associated with Objective-C, but in a “safer” way, making it easier to catch software bugs. Swift was introduced in 2014.Wikipedia: Swift (programming language)
Swift is a popular programming language for the Apple platforms it supports, but it lacks support for Microsoft Windows environments.TIOBE: Index.
Example
Hello World
// This program displays "Hello world!"
//
// References:
// https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/GuidedTour.html
print("Hello world!")
Output
Hello world!
Discussion
Each code element represents:Programming Fundamentals/Hello World
// begins a comment
print() calls the print function
"Hello world!" is the literal string to be displayed
Swift IDEs
There are several free cloud-based and local IDEs available to begin coding in Swift. Check with your instructor or do your own research for recommendations.
Cloud-Based IDEs
GDB Online
IBM Swift Sandbox
Ideone
iSwift
paiza.IO
repl.it
Local IDEs
Wikipedia: AppCode
Wikipedia: Atom (text editor)
Wikipedia: Xcode
References
Wikiversity: Computer Programming