Swift

1 program Added 2025-10-22T09:33:45Z Model: meta-llama/llama-3.1-70b-instructTemp: 0.4 Evidence Report issue View issues
Aliases: Swift 2, Swift 3, Swift 4, Swift 5
Provenance: commit 66aaba9254 · authored 2025-10-22T11:33:45+02:00 · model meta-llama/llama-3.1-70b-instruct

Sources mentioning this language

8 sources · pl_id: pl/swift
LLM (this repo) · 1PldbLinguistPygmentsWikipediaHyperpolyglotRosettacodeWikidata · Q17118377

Wikipedia infobox

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Paradigmsmulti-paradigm: protocol-oriented · object-oriented · functional · imperative · block structured · declarative · concurrent
Typingstatic, strong, inferred
Designed byApple Inc · open-source contributors · Chris Lattner · Doug Gregor · John McCall · Ted Kremenek · Joe Groff · and Apple Inc
First appeared2014
Influenced byObjective-C · Rust · Haskell · Ruby · Python · C# · CLU · D
LicenseApache License 2.0 (Swift 2.2 and later) Proprietary (up to Swift 2.2)

Extensions claimed by this language

3 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.swiftlinguistprimary50.5M files
.swiftpygmentsprimary50.5M files
.swiftwikidataprimary50.5M files

Related languages

SwiftScript (0.22)Swift/T (0.18)Source (0.14)SableCC (0.13)SETL2 (0.11)

LLM-contributed programs

Swift Markdown Parser

Provenance: commit 66aaba9254 · authored 2025-10-22T11:33:45+02:00 · model meta-llama/llama-3.1-70b-instruct · Temp 0.4
code.swift · license: MIT · added: 2025-10-22T09:33:45Z
import Foundation

public enum Markdown {
    case header(Int, String)
    case paragraph(String)
    case codeBlock(String, String)
    case unorderedList([String])
    case orderedList([String])
    case horizontalRule
    case image(String, String)
    case link(String, String)
    case bold(String)
    case italic(String)
    case strikethrough(String)
    case inlineCode(String)
}

extension Markdown {
    public var html: String {
        switch self {
        case.header(let level, let text):
            return "<h\(level)>\(text)</h\(level)>"
        case.paragraph(let text):
            return "<p>\(text)</p>"
        case.codeBlock(let code, let language):
            return "<pre><code class='\(language)'>\(code)</code></pre>"
        case.unorderedList(let items):
            return "<ul>\(items.map { "<li>\($0)</li>" }.joined())</ul>"
        case.orderedList(let items):
            return "<ol>\(items.map { "<li>\($0)</li>" }.joined())</ol>"
        case.horizontalRule:
            return "<hr>"
        case.image(let url, let alt):
            return "<img src='\(url)' alt='\(alt)'>"
        case.link(let url, let text):
            return "<a href='\(url)'>\(text)</a>"
        case.bold(let text):
            return "<b>\(text)</b>"
        case.italic(let text):
            return "<i>\(text)</i>"
        case.strikethrough(let text):
            return "<s>\(text)</s>"
        case.inlineCode(let code):
            return "<code>\(code)</code>"
        }
    }
}

Real programs from Software Heritage

No SWH evidence indexed yet for this language. (Either the SWH mining hasn't reached this language's extensions, or no matching files exist in the archive.)

Contribute — propose a file extension

Tell us where to find evidence about Swift (mapped to pl/swift). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Swift/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← SWI-Prolog Swift (parallel scripting language) →