|
| 1 | +/// Constants defining common MIME types for embedded content. |
| 2 | +/// |
| 3 | +/// MIME types (Multipurpose Internet Mail Extensions types) are a standard |
| 4 | +/// way to indicate the type of content being served. This enum provides |
| 5 | +/// type-safe constants for common MIME types used with embedded content. |
| 6 | +/// |
| 7 | +/// - SeeAlso: [IANA Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml) |
| 8 | +/// |
| 9 | +/// ## See Also |
| 10 | +/// |
| 11 | +/// - ``Embed`` |
| 12 | +@available(iOS 17.0, macOS 14.0, *) |
| 13 | +public enum MimeType: String, Sendable { |
| 14 | + // MARK: - Video types |
| 15 | + |
| 16 | + /// MPEG-4 video format |
| 17 | + case videoMP4 = "video/mp4" |
| 18 | + |
| 19 | + /// WebM video format |
| 20 | + case videoWebM = "video/webm" |
| 21 | + |
| 22 | + /// Ogg video format |
| 23 | + case videoOgg = "video/ogg" |
| 24 | + |
| 25 | + /// QuickTime video format |
| 26 | + case videoQuickTime = "video/quicktime" |
| 27 | + |
| 28 | + // MARK: - Audio types |
| 29 | + |
| 30 | + /// MPEG audio format (MP3) |
| 31 | + case audioMPEG = "audio/mpeg" |
| 32 | + |
| 33 | + /// Ogg audio format |
| 34 | + case audioOgg = "audio/ogg" |
| 35 | + |
| 36 | + /// WAV audio format |
| 37 | + case audioWAV = "audio/wav" |
| 38 | + |
| 39 | + /// WebM audio format |
| 40 | + case audioWebM = "audio/webm" |
| 41 | + |
| 42 | + // MARK: - Application types |
| 43 | + |
| 44 | + /// PDF document |
| 45 | + case applicationPDF = "application/pdf" |
| 46 | + |
| 47 | + /// Adobe Flash (deprecated but still in use) |
| 48 | + case applicationFlash = "application/x-shockwave-flash" |
| 49 | + |
| 50 | + /// JSON data |
| 51 | + case applicationJSON = "application/json" |
| 52 | + |
| 53 | + /// XML data |
| 54 | + case applicationXML = "application/xml" |
| 55 | + |
| 56 | + // MARK: - Image types |
| 57 | + |
| 58 | + /// SVG vector image |
| 59 | + case imageSVG = "image/svg+xml" |
| 60 | + |
| 61 | + /// PNG image |
| 62 | + case imagePNG = "image/png" |
| 63 | + |
| 64 | + /// JPEG image |
| 65 | + case imageJPEG = "image/jpeg" |
| 66 | + |
| 67 | + /// GIF image |
| 68 | + case imageGIF = "image/gif" |
| 69 | + |
| 70 | + /// WebP image |
| 71 | + case imageWebP = "image/webp" |
| 72 | + |
| 73 | + // MARK: - Text types |
| 74 | + |
| 75 | + /// Plain text |
| 76 | + case textPlain = "text/plain" |
| 77 | + |
| 78 | + /// HTML document |
| 79 | + case textHTML = "text/html" |
| 80 | + |
| 81 | + /// CSS stylesheet |
| 82 | + case textCSS = "text/css" |
| 83 | +} |
0 commit comments