Skip to content
Novus Examples
swift63 B

Swift — Hello World

The classic hello-world in Swift — a single print — for testing highlighters, the Swift compiler, and parsers.

Preview — first 3 linesswift
// The classic first program, in Swift.
print("Hello, world!")

Specifications

Language
Swift
Kind
hello-world
Lines
2
Encoding
UTF-8
Line Endings
LF

What is a .swift file?

Swift (.swift) is a plain-text source file for the Swift programming language — a statically typed, compiled language from Apple used for iOS, macOS, and server development. It emphasises safety with optionals and value types, and features structs, protocols, generics, and pattern matching.

How to use this file

Use an example .swift file to test syntax highlighters, the Swift compiler, linters and formatters (SwiftLint, swift-format), and parser or language-detection tooling.

Generated by generation/code_samples.py. Free for any use, no attribution required — license.