Swift is a general-purpose programming language that’s approachable for newcomers and powerful for experts. It is fast, modern, safe, and a joy to write.
struct Binomial: Codable {
var genus: String
var species: String
var subspecies: String?
}
let tree = Binomial(genus: "Pin", species: "oak")
let jsonData = try JSONEncoder().encode(tree)
// {"genus":"Pin","species":"oak"}
struct ScientificName {
var genus: String
var species: String
var subspecies: String?
var description: String {
var text = "\(genus) \(species)"
if let subspecies {
// subspecies guaranteed to be non-nil
text += "subsp. \(subspecies)"
}
return text
}
}
let hello = "Hello, world!"
let multilineString = """
@@@
@@ @@@@
@@ @@@ @@@@@
@@@@@@@@@ @@@@@
@@@@@@@@@@ @@@@@@
@@@@@@@@@@ @@@@@@
@@@@@@@@@@@@@@@@@
@ @@@@@@@@@@@@@@@
@@@@@@ @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@ @
\(hello)
"""
Use Cases
-
Apple Platforms
Swift is a powerful and intuitive programming language optimized when running on iOS, macOS, and other Apple platforms.
Learn more
Apple offers a wide variety of frameworks and APIs that make applications developed for these platforms unique and fun. -
Cross-platform Command-line
Writing Swift is interactive and fun, the syntax is concise yet expressive. Swift code is safe by design and produces software that runs lightning-fast.
Learn more
SwiftArgumentParser and Swift's growing package ecosystem make developing cross-platform command-line tools a breeze. -
Server and Networking
Swift's small memory footprint, quick startup time, and deterministic performance make it a great choice for server and other networked applications.
Learn more
SwiftNIO and Swift's dynamic server ecosystem bring joy to developing networked applications.
Getting Involved
Everyone is welcome to contribute to Swift. Contributing doesn’t just mean writing code or submitting pull request — there are many different ways for you to get involved, including answering questions on the forums, reporting or triaging bugs, and participating in the Swift evolution process.
No matter how you want to get involved, we ask that you first learn what’s expected of anyone who participates in the project by reading the Community Overview. If you’re contributing code, you should also know how to build and run Swift from the repository, as described in Source Code.
-
Design
Help shape the future of Swift by participating in the Swift evolution process.
Learn more -
Code
Contribute to the Swift compiler, standard library, and other core components of the project.
Learn more -
Troubleshoot
Help improve the quality of Swift by reporting and triaging bugs.
Learn more
What’s New
Stay up-to-date with the latest in the Swift community.