TextText-based

text/x-swift

Swift Source

Reference for text/x-swift, the MIME type for Swift programming language source files used in Apple platform development.

MIME Type Detector

Drop a file to detect its MIME type — no upload, runs in your browser

📄

Drop any file here or click to choose

Expected extensions: .swift

HTTP Content-Type Header

HTTP Header
Content-Type: text/x-swift; charset=utf-8

Associated File Extensions

.swift

Quick Facts

MIME Typetext/x-swift
CategoryText
TypeText-based (human-readable)
Extensions.swift

Common Usage

Swift source files are used for iOS, macOS, watchOS, and tvOS application development. Swift is Apple's modern programming language, replacing Objective-C for new projects.

It is also used for server-side development with Vapor and Hummingbird frameworks.

Code Examples

HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.swift" type="text/x-swift">

<!-- Or for script/media elements -->
<script type="text/x-swift" src="file.swift"></script>
Node.js
// Express.js
app.get('/file', (req, res) => {
  res.type('text/x-swift');
  res.send(data);
});

// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-swift' });
nginx
# nginx.conf — add to types block or use default
types {
    text/x-swift  swift;
}

# Or set for a specific location
location /api/ {
    default_type text/x-swift;
}

Related MIME Types

More Text MIME Types

Other text types in the Text family

Related Tools

Explore More MIME Types

Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.