Swift is ageneral-purposeprogramming language that’sapproachablefor newcomers andpowerfulfor experts.It isfast,modern,safe,and ajoyto write.
structBinomial:Codable{
vargenus:String
varspecies:String
varsubspecies:String?
}
lettree=Binomial(genus:"Pin",species:"oak")
letjsonData=tryJSONEncoder().encode(tree)
// { "genus": "Pin", "species": "oak" }
structScientificName{
vargenus:String
varspecies:String
varsubspecies:String?
vardescription:String{
vartext="\(genus)\(species)"
ifletsubspecies{
// subspecies guaranteed to be non-nil
text+="subsp.\(subspecies)"
}
returntext
}
}
lethello="Hello, world!"
letmultilineString="""
@@@
@@ @@@@
@@ @@@ @@@@@
@@@@@@@@@ @@@@@
@@@@@@@@@@ @@@@@@
@@@@@@@@@@ @@@@@@
@@@@@@@@@@@@@@@@@
@ @@@@@@@@@@@@@@@
@@@@@@ @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@ @
\(hello)
"""
Use Cases xml version= "1.0" encoding= "utf-8"?
-
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 xml version= "1.0" encoding= "utf-8"?
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 theCommunity Overview.If you’re contributing code, you should also know how to build and run Swift from the repository, as described inSource Code.
-
Design
Help shape the future of Swift by participating inthe 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 xml version= "1.0" encoding= "utf-8"?
Stay up-to-date with the latest in the Swift community.