Compare commits

...

No commits in common. "docs" and "master" have entirely different histories.
docs ... master

98 changed files with 14092 additions and 55166 deletions

11
.gitignore vendored
View File

@ -1,4 +1,9 @@
.DS_Store
.idea
.build
undocumented.json
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
docs/generated

8
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

2
.idea/MediaType.iml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="External" external.linked.project.id="MediaType" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="SPM" type="CPP_MODULE" version="4" />

View File

@ -0,0 +1,48 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<HTMLCodeStyleSettings>
<option name="HTML_UNIFORM_INDENT" value="true" />
<option name="HTML_ATTRIBUTE_WRAP" value="4" />
<option name="HTML_KEEP_BLANK_LINES" value="1" />
<option name="HTML_ALIGN_TEXT" value="true" />
<option name="HTML_ELEMENTS_TO_REMOVE_NEW_LINE_BEFORE" value="" />
<option name="HTML_DO_NOT_INDENT_CHILDREN_OF" value="" />
<option name="HTML_ENFORCE_QUOTES" value="true" />
<option name="HTML_NEWLINE_AFTER_LAST_ATTRIBUTE" value="When multiline" />
</HTMLCodeStyleSettings>
<SwiftCodeStyleSettings>
<option name="INDENT_DIRECTIVE_CHILDREN" value="true" />
</SwiftCodeStyleSettings>
<XML>
<option name="XML_ATTRIBUTE_WRAP" value="4" />
</XML>
<codeStyleSettings language="HTML">
<option name="SOFT_MARGINS" value="80" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Swift">
<option name="BLANK_LINES_AROUND_CLASS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="KEEP_SIMPLE_BLOCKS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_METHODS_IN_ONE_LINE" value="true" />
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="XML">
<option name="SOFT_MARGINS" value="120" />
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<includedPredefinedLibrary name="Node.js Core" />
</component>
</project>

16
.idea/misc.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SwiftPackageManagerSettings">
<option name="linkedExternalProjectsSettings">
<SwiftPackageManagerProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</SwiftPackageManagerProjectSettings>
</option>
</component>
<component name="SwiftPackageManagerWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/MediaType.iml" filepath="$PROJECT_DIR$/.idea/MediaType.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

12
.jazzy.yaml Normal file
View File

@ -0,0 +1,12 @@
output: docs/generated
author: 21Gram Technology Kft.
author_url: https://21gram.hu
source_host_url: https://github.com/21GramConsulting/MediaType
title: Swift MediaType Docs
undocumented_text: ""
theme: jony

View File

@ -1,781 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Enumerations Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO"></a>
<a name="//apple_ref/swift/Enum/Anything" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO">Anything</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Enums/Anything.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Anything</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType11ApplicationO"></a>
<a name="//apple_ref/swift/Enum/Application" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType11ApplicationO">Application</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>application</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#application">official documentation</a> for details.</p>
<p>You typically use <code>Application</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">application</span> <span class="o">=</span> <span class="kt">Application</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="n">application</span><span class="p">)</span> <span class="c1">// Creates: application/atom+xml;charset=utf-8</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access application values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="kt">Application</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">application</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">cbor</span><span class="p">,</span> <span class="n">_</span><span class="p">),</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">,</span> <span class="n">_</span><span class="p">),</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="n">_</span><span class="p">):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">cbor</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">zip</span><span class="p">))</span> <span class="c1">// Returns: false</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">json</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Application.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Application</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5AudioO"></a>
<a name="//apple_ref/swift/Enum/Audio" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5AudioO">Audio</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>audio</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#audio">official documentation</a> for details.</p>
<p>You typically use <code>Audio</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">audio</span> <span class="o">=</span> <span class="kt">Audio</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32000</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="n">audio</span><span class="p">)</span> <span class="c1">// Creates: audio/ac3;rate=32000</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access audio values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="kt">Audio</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">audio</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">ac3</span><span class="p">,</span> <span class="o">.</span><span class="n">aac</span><span class="p">,</span> <span class="o">.</span><span class="nv">ogg</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">ac3</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">aac</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">ogg</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mpeg</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Audio.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Audio</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO"></a>
<a name="//apple_ref/swift/Enum/Font" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO">Font</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>font</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official documentation</a> for details.</p>
<p>You typically use <code>Font</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">font</span> <span class="o">=</span> <span class="kt">Font</span><span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">font</span><span class="p">(</span><span class="n">font</span><span class="p">)</span> <span class="c1">// Creates: font/ttf;layout=oat,aat</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access font values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="kt">Font</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">font</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">woff</span><span class="p">,</span> <span class="o">.</span><span class="nv">woff2</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="k">let</span> <span class="nv">parameters</span><span class="p">?):</span> <span class="k">return</span> <span class="o">!</span><span class="n">parameters</span><span class="o">.</span><span class="n">isEmpty</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">woff</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">]))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Font.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Font</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ImageO"></a>
<a name="//apple_ref/swift/Enum/Image" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ImageO">Image</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>image</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#image">official documentation</a> for details.</p>
<p>You typically use <code>Image</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">image</span> <span class="o">=</span> <span class="kt">Image</span><span class="o">.</span><span class="nf">png</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="n">image</span><span class="p">)</span> <span class="c1">// Creates: image/png</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access image values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">image</span><span class="p">:</span> <span class="kt">Image</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">image</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">png</span><span class="p">,</span> <span class="o">.</span><span class="n">jpeg</span><span class="p">,</span> <span class="o">.</span><span class="nv">gif</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">png</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">jpeg</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">gif</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">bmp</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Image.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Image</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO"></a>
<a name="//apple_ref/swift/Enum/MediaType" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO">MediaType</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A type-safe representation of <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s
(or formerly known as MIME types).</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create
media type instances simply using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>Media type suffixes and parameters are supported both via string literals and <code>MediaType</code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<p>You can create media type trees using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
<a href="Enums/MediaType.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MediaType</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO"></a>
<a name="//apple_ref/swift/Enum/Message" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO">Message</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>message</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official documentation</a> for details.</p>
<p>You typically use <code>Message</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">message</span> <span class="o">=</span> <span class="kt">Message</span><span class="o">.</span><span class="nf">http</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">message</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="c1">// Creates: message/http</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access message values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">message</span><span class="p">:</span> <span class="kt">Message</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">message</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">http</span><span class="p">,</span> <span class="o">.</span><span class="nv">rfc822</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">http</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">rfc822</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">sip</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Message.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Message</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO"></a>
<a name="//apple_ref/swift/Enum/Model" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO">Model</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>model</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official documentation</a> for details.</p>
<p>You typically use <code>Model</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">model</span> <span class="o">=</span> <span class="kt">Model</span><span class="o">.</span><span class="nf">step</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">model</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <span class="c1">// Creates: model/step</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access model values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="kt">Model</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">model</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">step</span><span class="p">,</span> <span class="o">.</span><span class="nv">iges</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">step</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">iges</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mesh</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Model.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Model</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO"></a>
<a name="//apple_ref/swift/Enum/Multipart" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO">Multipart</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multipart</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official documentation</a> for details.</p>
<p>You typically use <code>Multipart</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">multipart</span> <span class="o">=</span> <span class="kt">Multipart</span><span class="o">.</span><span class="nf">formData</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">multipart</span><span class="p">(</span><span class="n">multipart</span><span class="p">)</span> <span class="c1">// Creates: multipart/form-data</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access multipart values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">multipart</span><span class="p">:</span> <span class="kt">Multipart</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">multipart</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">formData</span><span class="p">,</span> <span class="o">.</span><span class="nv">mixed</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">formData</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mixed</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">voiceMessage</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Multipart.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Multipart</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO"></a>
<a name="//apple_ref/swift/Enum/Suffix" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO">Suffix</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the media type <a href="https://en.wikipedia.org/wiki/Media_type#Suffix">suffix</a>es.</p>
<p>The library allows all <code><a href="Enums/MediaType.html">MediaType</a></code>s to have a suffix. Keep in mind though, that not all such combinations are
registered (see the <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>It is also possible to create completely custom suffixes by using either the <code><a href="Enums/Suffix.html#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:)</a></code> case directly or a
string literal.</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Creates: application/jose+json</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"custom"</span><span class="p">)))</span> <span class="c1">// Creates: application/jose+custom</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="s">"zip"</span><span class="p">))</span> <span class="c1">// Creates: image/svg+zip</span>
</code></pre>
<p>You can access a media type&rsquo;s suffix by matching using a <code>switch</code> statement:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="k">let</span> <span class="nv">suffix</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">suffix</span> <span class="o">=</span> <span class="n">suffix</span> <span class="k">else</span> <span class="p">{</span> <span class="k">break</span> <span class="p">}</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Suffix: </span><span class="se">\(</span><span class="n">suffix</span><span class="se">)</span><span class="s">"</span><span class="p">,</span> <span class="s">"Suffix: +xml"</span><span class="p">)</span>
<span class="k">default</span><span class="p">:</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Unsupported media type: </span><span class="se">\(</span><span class="n">mediaType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href="Enums/Suffix.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Suffix</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4TextO"></a>
<a name="//apple_ref/swift/Enum/Text" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4TextO">Text</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>text</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#text">official documentation</a> for details.</p>
<p>You typically use <code>Text</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">text</span> <span class="o">=</span> <span class="kt">Text</span><span class="o">.</span><span class="nf">html</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">text</span><span class="p">(</span><span class="n">text</span><span class="p">)</span> <span class="c1">// Creates: text/html</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access text values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">text</span><span class="p">:</span> <span class="kt">Text</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">text</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">html</span><span class="p">,</span> <span class="o">.</span><span class="nv">css</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">html</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">css</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">javascript</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Text.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Text</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5VideoO"></a>
<a name="//apple_ref/swift/Enum/Video" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5VideoO">Video</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>video</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#video">official documentation</a> for details.</p>
<p>You typically use <code>Video</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">video</span> <span class="o">=</span> <span class="kt">Video</span><span class="o">.</span><span class="nf">mp4</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">video</span><span class="p">(</span><span class="n">video</span><span class="p">)</span> <span class="c1">// Creates: video/mp4</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access video values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">video</span><span class="p">:</span> <span class="kt">Video</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">video</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">mp4</span><span class="p">,</span> <span class="o">.</span><span class="kt">H264</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mp4</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="kt">H264</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">vc1</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Video.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Video</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,350 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Anything Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Anything" class="dashAnchor"></a>
<a title="Anything Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Anything Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Anything</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Anything</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO5otheryACs23CustomStringConvertible_p_AA6SuffixOSgSDySSsAE_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO5otheryACs23CustomStringConvertible_p_AA6SuffixOSgSDySSsAE_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,544 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Font Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Font" class="dashAnchor"></a>
<a title="Font Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Font Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Font</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Font</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>font</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official documentation</a> for details.</p>
<p>You typically use <code>Font</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">font</span> <span class="o">=</span> <span class="kt">Font</span><span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">font</span><span class="p">(</span><span class="n">font</span><span class="p">)</span> <span class="c1">// Creates: font/ttf;layout=oat,aat</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access font values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="kt">Font</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">font</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">woff</span><span class="p">,</span> <span class="o">.</span><span class="nv">woff2</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="k">let</span> <span class="nv">parameters</span><span class="p">?):</span> <span class="k">return</span> <span class="o">!</span><span class="n">parameters</span><span class="o">.</span><span class="n">isEmpty</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">woff</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">]))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO10collectionyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/collection(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO10collectionyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">collection(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>collection</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">collection</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO3otfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/otf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO3otfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">otf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>otf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">otf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4sfntyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sfnt(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4sfntyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sfnt(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sfnt</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sfnt</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO3ttfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/ttf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO3ttfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">ttf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>ttf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">ttf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4woffyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/woff(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4woffyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">woff(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>woff</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">woff</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO5woff2yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/woff2(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO5woff2yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">woff2(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>woff2</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">woff2</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,712 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>MediaType Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/MediaType" class="dashAnchor"></a>
<a title="MediaType Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
MediaType Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>MediaType</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MediaType</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>A type-safe representation of <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s
(or formerly known as MIME types).</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create
media type instances simply using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>Media type suffixes and parameters are supported both via string literals and <code>MediaType</code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<p>You can create media type trees using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO11applicationyAbA11ApplicationOcABmF"></a>
<a name="//apple_ref/swift/Element/application(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO11applicationyAbA11ApplicationOcABmF">application(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>application</code> media type.</p>
<p>Represents binary data. Common examples: <code>application/json</code>, <code>application/octet-stream</code>.</p>
<p>For the whole family of <code>application</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#application">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">application</span><span class="p">(</span><span class="kt"><a href="../Enums/Application.html">Application</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5audioyAbA5AudioOcABmF"></a>
<a name="//apple_ref/swift/Element/audio(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5audioyAbA5AudioOcABmF">audio(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>audio</code> media type.</p>
<p>Represents audible data. Common examples: <code>audio/ac3</code>, <code>audio/mpeg</code>.</p>
<p>For the whole family of <code>audio</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#audio">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">audio</span><span class="p">(</span><span class="kt"><a href="../Enums/Audio.html">Audio</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO4fontyAbA4FontOcABmF"></a>
<a name="//apple_ref/swift/Element/font(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO4fontyAbA4FontOcABmF">font(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>font</code> media type.</p>
<p>Represents font or typeface data. Common examples: <code>font/woff</code>, <code>font/ttf</code>.</p>
<p>For the whole family of <code>font</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">font</span><span class="p">(</span><span class="kt"><a href="../Enums/Font.html">Font</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5imageyAbA5ImageOcABmF"></a>
<a name="//apple_ref/swift/Element/image(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5imageyAbA5ImageOcABmF">image(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>image</code> media type.</p>
<p>Represents image or graphical data. This includes bitmap and vector images, along with animated image formats.
Common examples: <code>image/jpeg</code>, <code>image/apng</code>.</p>
<p>For the whole family of <code>image</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#image">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">image</span><span class="p">(</span><span class="kt"><a href="../Enums/Image.html">Image</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO7messageyAbA7MessageOcABmF"></a>
<a name="//apple_ref/swift/Element/message(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO7messageyAbA7MessageOcABmF">message(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>message</code> media type.</p>
<p>Represents embedded message data. Common examples: <code>message/rfc882</code>, <code>message/http</code>.</p>
<p>For the whole family of <code>message</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">message</span><span class="p">(</span><span class="kt"><a href="../Enums/Message.html">Message</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5modelyAbA5ModelOcABmF"></a>
<a name="//apple_ref/swift/Element/model(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5modelyAbA5ModelOcABmF">model(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>model</code> media type.</p>
<p>Represents 3D modelling data. Common examples: <code>model/step</code>, <code>model/3mf</code>.</p>
<p>For the whole family of <code>model</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">model</span><span class="p">(</span><span class="kt"><a href="../Enums/Model.html">Model</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO9multipartyAbA9MultipartOcABmF"></a>
<a name="//apple_ref/swift/Element/multipart(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO9multipartyAbA9MultipartOcABmF">multipart(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multipart</code> media type.</p>
<p>Represents data formed from multiple components, which may have their individual media types.
Common examples: <code>multipart/form-data</code>, <code>multipart/encrypted</code>.</p>
<p>For the whole family of <code>multipart</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">multipart</span><span class="p">(</span><span class="kt"><a href="../Enums/Multipart.html">Multipart</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO4textyAbA4TextOcABmF"></a>
<a name="//apple_ref/swift/Element/text(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO4textyAbA4TextOcABmF">text(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>text</code> media type.</p>
<p>Represents textual only data. Common examples: <code>text/css</code>, <code>text/html</code>.</p>
<p>For the whole family of <code>text</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#text">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">text</span><span class="p">(</span><span class="kt"><a href="../Enums/Text.html">Text</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5videoyAbA5VideoOcABmF"></a>
<a name="//apple_ref/swift/Element/video(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5videoyAbA5VideoOcABmF">video(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>video</code> media type.</p>
<p>Represents video data. Common examples: <code>video/mp4</code>, <code>video/H264</code>.</p>
<p>For the whole family of <code>video</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#video">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">video</span><span class="p">(</span><span class="kt"><a href="../Enums/Video.html">Video</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5otheryABs23CustomStringConvertible_p_sAD_pAA6SuffixOSgSDySSsAD_pSgGSgtcABmF"></a>
<a name="//apple_ref/swift/Element/other(type:subtype:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5otheryABs23CustomStringConvertible_p_sAD_pAA6SuffixOSgSDySSsAD_pSgGSgtcABmF">other(type:<wbr>subtype:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a custom media type that is currently not officially defined.</p>
<p>Represents a custom media type with the given <code>type</code> and <code>subtype</code>. Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and
<code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="nv">type</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">subtype</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8anythingyAbA8AnythingOcABmF"></a>
<a name="//apple_ref/swift/Element/anything(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8anythingyAbA8AnythingOcABmF">anything(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a wildcard media type.</p>
<p>A wildcard media type has a type of <code>*</code>. A few examples:</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">anything</span><span class="p">())</span> <span class="c1">// Creates: */*</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"dialog"</span><span class="p">))</span> <span class="c1">// Creates: */dialog</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"response"</span><span class="p">,</span> <span class="o">.</span><span class="n">xml</span><span class="p">))</span> <span class="c1">// Creates: */response+xml</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="kt"><a href="../Enums/Anything.html">Anything</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The textual representation of the media type.</p>
<p>The string form of a media type follows the pattern: <code>type/subtype[+suffix][;parameters]</code>. A few examples:</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">text</span><span class="p">(</span><span class="o">.</span><span class="nf">css</span><span class="p">())</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: text/css</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32000</span><span class="p">]))</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: audio/ac3;rate=32000</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: application/atom+xml;charset=utf-8</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8rawValueABSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8rawValueABSS_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a media type from its raw string value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>rawValue</em>
</code>
</td>
<td>
<div>
<p>The raw string value.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8rawValueSSvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8rawValueSSvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The raw string value of the media type.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO13stringLiteralABSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO13stringLiteralABSS_tcfc">init(stringLiteral:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a media type from a string literal.</p>
<p>Do not call this initializer directly. This rather allows you to use a string literal where you have to provide
a <code>MediaType</code> node.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO2eeoiySbAB_ABtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO2eeoiySbAB_ABtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns a Boolean indicating whether two media types are the same.</p>
<p>Two media types represent the same thing, and thus considered to be equal, if they have the same type, subtype,
<code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,894 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Message Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Message" class="dashAnchor"></a>
<a title="Message Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Message Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Message</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Message</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>message</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official documentation</a> for details.</p>
<p>You typically use <code>Message</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">message</span> <span class="o">=</span> <span class="kt">Message</span><span class="o">.</span><span class="nf">http</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">message</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="c1">// Creates: message/http</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access message values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">message</span><span class="p">:</span> <span class="kt">Message</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">message</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">http</span><span class="p">,</span> <span class="o">.</span><span class="nv">rfc822</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">http</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">rfc822</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">sip</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4CPIMyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/CPIM(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4CPIMyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">CPIM(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>CPIM</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="kt">CPIM</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14deliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/deliveryStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14deliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">deliveryStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>delivery-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">deliveryStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO23dispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/dispositionNotification(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO23dispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">dispositionNotification(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>disposition-notification</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">dispositionNotification</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO12externalBodyyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/externalBody(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO12externalBodyyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">externalBody(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>external-body</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">externalBody</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14feedbackReportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/feedbackReport(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14feedbackReportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">feedbackReport(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>feedback-report</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">feedbackReport</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO6globalyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/global(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO6globalyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">global(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">global</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO20globalDeliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalDeliveryStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO20globalDeliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalDeliveryStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-delivery-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalDeliveryStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO29globalDispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalDispositionNotification(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO29globalDispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalDispositionNotification(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-disposition-notification</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalDispositionNotification</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO13globalHeadersyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalHeaders(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO13globalHeadersyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalHeaders(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-headers</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalHeaders</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4httpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/http(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4httpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">http(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>http</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">http</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4imdnyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/imdn(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4imdnyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">imdn(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>imdn</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">imdn</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4newsyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/news(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4newsyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">news(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>news</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">news</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7partialyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/partial(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7partialyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">partial(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>partial</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">partial</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO6rfc822yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/rfc822(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO6rfc822yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">rfc822(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>rfc822</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">rfc822</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO5sHttpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sHttp(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO5sHttpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sHttp(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>s-http</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sHttp</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO3sipyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sip(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO3sipyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sip(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sip</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sip</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7sipfragyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sipfrag(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7sipfragyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sipfrag(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sipfrag</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sipfrag</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14trackingStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/trackingStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14trackingStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">trackingStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>tracking-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">trackingStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,786 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Model Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Model" class="dashAnchor"></a>
<a title="Model Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Model Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Model</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Model</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>model</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official documentation</a> for details.</p>
<p>You typically use <code>Model</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">model</span> <span class="o">=</span> <span class="kt">Model</span><span class="o">.</span><span class="nf">step</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">model</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <span class="c1">// Creates: model/step</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access model values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="kt">Model</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">model</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">step</span><span class="p">,</span> <span class="o">.</span><span class="nv">iges</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">step</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">iges</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mesh</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4_3mfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/_3mf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4_3mfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">_3mf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>3mf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">_3mf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3e57yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/e57(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3e57yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">e57(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>e57</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">e57</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO10gltfBinaryyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/gltfBinary(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO10gltfBinaryyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">gltfBinary(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gltf-binary</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">gltfBinary</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4gltfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/gltf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4gltfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">gltf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gltf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">gltf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4igesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/iges(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4igesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">iges(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>iges</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">iges</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4meshyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mesh(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4meshyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mesh(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mesh</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mesh</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3mtlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mtl(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3mtlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mtl(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mtl</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mtl</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3objyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/obj(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3objyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">obj(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>obj</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">obj</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4stepyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/step(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4stepyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">step(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>step</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">step</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7stepXmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/stepXml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7stepXmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">stepXml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>step-xml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stepXml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3stlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/stl(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3stlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">stl(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>stl</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stl</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4vrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/vrml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4vrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">vrml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>vrml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">vrml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7x3dVrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/x3dVrml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7x3dVrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">x3dVrml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x3d-vrml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">x3dVrml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3x3dyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/x3d(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3x3dyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">x3d(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x3d</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">x3d</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,813 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Multipart Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Multipart" class="dashAnchor"></a>
<a title="Multipart Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Multipart Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Multipart</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Multipart</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>multipart</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official documentation</a> for details.</p>
<p>You typically use <code>Multipart</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">multipart</span> <span class="o">=</span> <span class="kt">Multipart</span><span class="o">.</span><span class="nf">formData</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">multipart</span><span class="p">(</span><span class="n">multipart</span><span class="p">)</span> <span class="c1">// Creates: multipart/form-data</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access multipart values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">multipart</span><span class="p">:</span> <span class="kt">Multipart</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">multipart</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">formData</span><span class="p">,</span> <span class="o">.</span><span class="nv">mixed</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">formData</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mixed</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">voiceMessage</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO11alternativeyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/alternative(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO11alternativeyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">alternative(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>alternative</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">alternative</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO11appledoubleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/appledouble(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO11appledoubleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">appledouble(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>appledouble</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">appledouble</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO10byterangesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/byteranges(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO10byterangesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">byteranges(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>byteranges</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">byteranges</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6digestyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/digest(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6digestyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">digest(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>digest</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">digest</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO9encryptedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/encrypted(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO9encryptedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">encrypted(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>encrypted</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">encrypted</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8formDatayAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/formData(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8formDatayAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">formData(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>form-data</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">formData</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO9headerSetyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/headerSet(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO9headerSetyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">headerSet(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>header-set</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">headerSet</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO5mixedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mixed(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO5mixedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mixed(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mixed</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mixed</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO12multilingualyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/multilingual(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO12multilingualyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">multilingual(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multilingual</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">multilingual</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8parallelyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/parallel(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8parallelyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">parallel(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>parallel</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">parallel</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO7relatedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/related(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO7relatedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">related(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>related</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">related</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6reportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/report(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6reportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">report(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>report</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">report</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6signedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/signed(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6signedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">signed(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>signed</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">signed</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO12voiceMessageyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/voiceMessage(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO12voiceMessageyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">voiceMessage(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>voice-message</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">voiceMessage</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO13xMixedReplaceyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/xMixedReplace(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO13xMixedReplaceyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">xMixedReplace(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x-mixed-replace</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">xMixedReplace</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,752 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Suffix Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Suffix" class="dashAnchor"></a>
<a title="Suffix Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Suffix Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Suffix</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Suffix</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the media type <a href="https://en.wikipedia.org/wiki/Media_type#Suffix">suffix</a>es.</p>
<p>The library allows all <code><a href="../Enums/MediaType.html">MediaType</a></code>s to have a suffix. Keep in mind though, that not all such combinations are
registered (see the <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>It is also possible to create completely custom suffixes by using either the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:)</a></code> case directly or a
string literal.</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Creates: application/jose+json</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"custom"</span><span class="p">)))</span> <span class="c1">// Creates: application/jose+custom</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="s">"zip"</span><span class="p">))</span> <span class="c1">// Creates: image/svg+zip</span>
</code></pre>
<p>You can access a media type&rsquo;s suffix by matching using a <code>switch</code> statement:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="k">let</span> <span class="nv">suffix</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">suffix</span> <span class="o">=</span> <span class="n">suffix</span> <span class="k">else</span> <span class="p">{</span> <span class="k">break</span> <span class="p">}</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Suffix: </span><span class="se">\(</span><span class="n">suffix</span><span class="se">)</span><span class="s">"</span><span class="p">,</span> <span class="s">"Suffix: +xml"</span><span class="p">)</span>
<span class="k">default</span><span class="p">:</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Unsupported media type: </span><span class="se">\(</span><span class="n">mediaType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3xmlyA2CmF"></a>
<a name="//apple_ref/swift/Element/xml" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3xmlyA2CmF">xml</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>xml</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xml</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4jsonyA2CmF"></a>
<a name="//apple_ref/swift/Element/json" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4jsonyA2CmF">json</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>json</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">json</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3beryA2CmF"></a>
<a name="//apple_ref/swift/Element/ber" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3beryA2CmF">ber</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>ber</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ber</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4cboryA2CmF"></a>
<a name="//apple_ref/swift/Element/cbor" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4cboryA2CmF">cbor</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>cbor</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cbor</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3deryA2CmF"></a>
<a name="//apple_ref/swift/Element/der" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3deryA2CmF">der</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>der</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">der</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO11fastinfosetyA2CmF"></a>
<a name="//apple_ref/swift/Element/fastinfoset" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO11fastinfosetyA2CmF">fastinfoset</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>fastinfoset</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">fastinfoset</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO5wbxmlyA2CmF"></a>
<a name="//apple_ref/swift/Element/wbxml" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO5wbxmlyA2CmF">wbxml</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>wbxml</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">wbxml</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3zipyA2CmF"></a>
<a name="//apple_ref/swift/Element/zip" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3zipyA2CmF">zip</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>zip</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">zip</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3tlvyA2CmF"></a>
<a name="//apple_ref/swift/Element/tlv" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3tlvyA2CmF">tlv</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>tlv</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">tlv</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7jsonSeqyA2CmF"></a>
<a name="//apple_ref/swift/Element/jsonSeq" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7jsonSeqyA2CmF">jsonSeq</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO4jsonyA2CmF">json</a></code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">jsonSeq</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7sqlite3yA2CmF"></a>
<a name="//apple_ref/swift/Element/sqlite3" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7sqlite3yA2CmF">sqlite3</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sqlite3</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">sqlite3</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3jwtyA2CmF"></a>
<a name="//apple_ref/swift/Element/jwt" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3jwtyA2CmF">jwt</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>jwt</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">jwt</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4gzipyA2CmF"></a>
<a name="//apple_ref/swift/Element/gzip" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4gzipyA2CmF">gzip</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gzip</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">gzip</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7cborSeqyA2CmF"></a>
<a name="//apple_ref/swift/Element/cborSeq" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7cborSeqyA2CmF">cborSeq</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO4cboryA2CmF">cbor</a></code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cborSeq</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4zstdyA2CmF"></a>
<a name="//apple_ref/swift/Element/zstd" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4zstdyA2CmF">zstd</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>zstd</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">zstd</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a custom suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,159 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Extensions Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Extensions" class="dashAnchor"></a>
<a title="Extensions Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Extensions Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Extensions</h1>
<p>The following extensions are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sq"></a>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a class="token" href="#/s:Sq">Optional</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Optional.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Optional</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span> <span class="k">where</span> <span class="kt">Wrapped</span> <span class="o">==</span> <span class="kt"><a href="Enums/Suffix.html">Suffix</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,173 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Optional Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a title="Optional Extension Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Optional Extension Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Optional</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Optional</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span> <span class="k">where</span> <span class="kt">Wrapped</span> <span class="o">==</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Available%20where%20%60Wrapped%60%20%3D%3D%20%60Suffix%60"></a>
<a name="//apple_ref/swift/Section/Available where `Wrapped` == `Suffix`" class="dashAnchor"></a>
<div class="section-name-container">
<a class="section-name-link" href="#/Available%20where%20%60Wrapped%60%20%3D%3D%20%60Suffix%60"></a>
<h3 class="section-name"><span>Available where <code>Wrapped</code> == <code><a href="../Enums/Suffix.html">Suffix</a></code></span>
</h3>
</div>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

7
LICENSE Normal file
View File

@ -0,0 +1,7 @@
Copyright 2021 "21Gram Technology Kft."
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

17
Package.swift Normal file
View File

@ -0,0 +1,17 @@
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "MediaType",
products: [
.library(
name: "MediaType",
targets: ["MediaType"]
),
],
targets: [
.target(name: "MediaType"),
.testTarget(name: "MediaTypeTests", dependencies: [.byName(name: "MediaType")])
]
)

139
README.md Normal file
View File

@ -0,0 +1,139 @@
# MediaType
## Overview
MediaType is a library that can be used to
create [Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)s in a type-safe manner.
Mainly intended &ndash; although not limited &ndash; to be used in [server-side Swift](https://www.swift.org/server)
applications.
## Creating Media Types
Media types are represented by the ``MediaType`` Swift type.
You can create a media type in a type-safe manner using one of the possible cases. You can also create media type
instances simply by using string literals.
```swift
let mediaType: MediaType = "application/json" // is equivalent to
MediaType.application(.json())
```
It is also possible to create a ``MediaType`` instance from a string variable as shown in the following example.
```swift
let rawMediaType = "application/json"
let mediaType = MediaType(rawValue: rawMediaType)
```
### Suffixes and Parameters
Media type ``Suffix``es and ``Parameters`` are supported both via string literals and ``MediaType`` cases.
```swift
let mediaType: MediaType = "application/atom; charset=utf-8" // is equivalent to
MediaType.application(.atom(nil, ["charset": "utf-8"]))
let mediaType: MediaType = "application/atom+xml" // is equivalent to
MediaType.application(.atom(.xml))
let mediaType: MediaType = "application/atom+xml; charset=utf-8" // is equivalent to
MediaType.application(.atom(.xml, ["charset": "utf-8"]))
```
### Trees
You can create media type trees by using either the string literal syntax, or using the `other` case of a particular
media type.
```swift
let mediaType: MediaType = "application/vnd.efi.img" // is equivalent to
MediaType.application(.other("vnd.efi.img"))
```
### Unregistered Media Types
Using this library you can create all the registered media types. The library is versatile enough to allow you to create
practically *any* media type, even ones that are *not* registered. A few examples of such cases:
```swift
let image: MediaType = "image/svg+gzip" // is equivalent to
MediaType.image(.svg(.gzip))
let application: MediaType = "application/myApp+json" // is equivalent to
MediaType.application(.other("myApp", .json))
```
## Using Media Types
You can use regular `switch` statements to test for media types and get access to their components. The following example
shows various ways to treat a media type.
```swift
func isSupported(_ mediaType: MediaType) -> Bool {
switch mediaType {
case .application(.json(_, _)): return true
case .application(.atom("xml", _)): return true
case .application(let subtype):
switch subtype {
case .xml(_, _): return true
default: return false
}
default: return false
}
}
isSupported("application/json") // Returns: true
isSupported("application/json+xml") // Returns: true
isSupported("application/json;charset=utf-8") // Returns: true
isSupported("application/json+xml;charset=utf-8") // Returns: true
isSupported("application/atom+xml") // Returns: true
isSupported("application/atom+xml;charset=utf-8") // Returns: true
isSupported("application/atom") // Returns: false
isSupported("application/atom;charset=utf-8") // Returns: false
```
### String Conversion
Since ``MediaType`` conforms to
the [`CustomStringConvertible`](https://developer.apple.com/documentation/swift/customstringconvertible) protocol it is
pretty straightforward to turn an instance into a string.
You can either call the ``MediaType/description`` computed property or simply embed an instance into an interpolated
string.
For example, you can request the list of available products in JSON from an imaginary store.
```swift
var request = URLRequest(url: URL(string: "https://example-store.com/products")!)
let contentType: MediaType = "application/json"
// The following two statements are equivalent
request.setValue("Content-Type", forHTTPHeaderField: "\(contentType)")
request.setValue("Content-Type", forHTTPHeaderField: contentType.description)
let (_, response) = try await URLSession.shared.data(for: request)
```
### Media Types are [`Hashable`](https://developer.apple.com/documentation/swift/hashable)
This means you can use ``MediaType``s in sets or dictionaries. For example, you can define the type of images your
application supports like so:
```swift
let supportedImages: Set<MediaType> = ["image/png", "image/gif", "image/jpeg"]
```
### Comparing Media Types
You can also compare media type for equality using the ``MediaType/==(lhs:rhs:)`` operator.
```swift
func canHandle(response: URLResponse) -> Bool {
guard let mimeType = response.mimeType else { return false }
let mediaType = MediaType(rawValue: mimeType)
return mediaType == .application(.json())
}
```

View File

@ -0,0 +1,61 @@
import Foundation
public enum Anything {
case other(CustomStringConvertible, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Anything: CustomStringConvertible {
public var description: String { rawValue }
}
extension Anything: MediaSubtype { public var type: MediaType { .anything(self) } }
extension Anything: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "*" : self = .anything(suffix, parameters)
default : self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .other(let subtype, let suffix, let params): return "\(subtype)\(suffix)\(params)"
case .anything(let suffix, let params): return "*\(suffix)\(params)"
}
}
}
extension Anything: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix.description)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,167 @@
import Foundation
/// Represents the `font` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#font) for details.
///
/// You typically use ``Font`` as a ``MediaType``.
///
/// ```swift
/// let font = Font.ttf(nil, ["layout": "oat,aat"])
/// let mediaType = MediaType.font(font) // Creates: font/ttf;layout=oat,aat
/// ```
///
/// You can use standard `switch` statement to access font values.
///
/// ```swift
/// func isSupported(font: Font) -> Bool {
/// switch font {
/// case .woff, .woff2: return true
/// case .ttf(_, let parameters?): return !parameters.isEmpty
/// default: return false
/// }
/// }
///
/// isSupported(font: .woff()) // Returns: true
/// isSupported(font: .ttf(nil, ["layout": "oat,aat"])) // Returns: true
/// isSupported(font: .ttf()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Font {
/// Represents the `collection` subtype.
case collection(Suffix? = nil, Parameters? = nil)
/// Represents the `otf` subtype.
case otf(Suffix? = nil, Parameters? = nil)
/// Represents the `sfnt` subtype.
case sfnt(Suffix? = nil, Parameters? = nil)
/// Represents the `ttf` subtype.
case ttf(Suffix? = nil, Parameters? = nil)
/// Represents the `woff` subtype.
case woff(Suffix? = nil, Parameters? = nil)
/// Represents the `woff2` subtype.
case woff2(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Font: CustomStringConvertible {
public var description: String { rawValue }
}
extension Font: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "collection": self = .collection(suffix, parameters)
case "otf": self = .otf(suffix, parameters)
case "sfnt": self = .sfnt(suffix, parameters)
case "ttf": self = .ttf(suffix, parameters)
case "woff": self = .woff(suffix, parameters)
case "woff2": self = .woff2(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .collection(let suffix, let parameters): return "collection\(suffix)\(parameters)"
case .otf(let suffix, let parameters): return "otf\(suffix)\(parameters)"
case .sfnt(let suffix, let parameters): return "sfnt\(suffix)\(parameters)"
case .ttf(let suffix, let parameters): return "ttf\(suffix)\(parameters)"
case .woff(let suffix, let parameters): return "woff\(suffix)\(parameters)"
case .woff2(let suffix, let parameters): return "woff2\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Font: MediaSubtype { public var type: MediaType { .font(self) } }
extension Font: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .collection(let lhsSuffix, let lhsParameters):
guard case let .collection(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .otf(let lhsSuffix, let lhsParameters):
guard case let .otf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .sfnt(let lhsSuffix, let lhsParameters):
guard case let .sfnt(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ttf(let lhsSuffix, let lhsParameters):
guard case let .ttf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .woff(let lhsSuffix, let lhsParameters):
guard case let .woff(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .woff2(let lhsSuffix, let lhsParameters):
guard case let .woff2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .collection(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .otf(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .sfnt(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .ttf(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .woff(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .woff2(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,635 @@
import Foundation
/// Represents the `image` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#image) for details.
///
/// You typically use ``Image`` as a ``MediaType``.
///
/// ```swift
/// let image = Image.png()
/// let mediaType = MediaType.image(image) // Creates: image/png
/// ```
///
/// You can use standard `switch` statement to access image values.
///
/// ```swift
/// func isSupported(image: Image) -> Bool {
/// switch image {
/// case .png, .jpeg, .gif: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .png()) // Returns: true
/// isSupported(audio: .jpeg()) // Returns: true
/// isSupported(audio: .gif()) // Returns: true
/// isSupported(audio: .bmp()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Image {
/// Represents the `aces` subtype.
case aces(Suffix? = nil, Parameters? = nil)
/// Represents the `avci` subtype.
case avci(Suffix? = nil, Parameters? = nil)
/// Represents the `avcs` subtype.
case avcs(Suffix? = nil, Parameters? = nil)
/// Represents the `avif` subtype.
case avif(Suffix? = nil, Parameters? = nil)
/// Represents the `bmp` subtype.
case bmp(Suffix? = nil, Parameters? = nil)
/// Represents the `cgm` subtype.
case cgm(Suffix? = nil, Parameters? = nil)
/// Represents the `dicom-rle` subtype.
case dicomRle(Suffix? = nil, Parameters? = nil)
/// Represents the `emf` subtype.
case emf(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `fits` subtype.
case fits(Suffix? = nil, Parameters? = nil)
/// Represents the `g3fax` subtype.
case g3fax(Suffix? = nil, Parameters? = nil)
/// Represents the `gif` subtype.
case gif(Suffix? = nil, Parameters? = nil)
/// Represents the `heic` subtype.
case heic(Suffix? = nil, Parameters? = nil)
/// Represents the `heic-sequence` subtype.
case heicSequence(Suffix? = nil, Parameters? = nil)
/// Represents the `heif` subtype.
case heif(Suffix? = nil, Parameters? = nil)
/// Represents the `heif-sequence` subtype.
case heifSequence(Suffix? = nil, Parameters? = nil)
/// Represents the `hej2k` subtype.
case hej2k(Suffix? = nil, Parameters? = nil)
/// Represents the `hsj2` subtype.
case hsj2(Suffix? = nil, Parameters? = nil)
/// Represents the `ief` subtype.
case ief(Suffix? = nil, Parameters? = nil)
/// Represents the `jls` subtype.
case jls(Suffix? = nil, Parameters? = nil)
/// Represents the `jp2` subtype.
case jp2(Suffix? = nil, Parameters? = nil)
/// Represents the `jpeg` subtype.
case jpeg(Suffix? = nil, Parameters? = nil)
/// Represents the `jph` subtype.
case jph(Suffix? = nil, Parameters? = nil)
/// Represents the `jphc` subtype.
case jphc(Suffix? = nil, Parameters? = nil)
/// Represents the `jpm` subtype.
case jpm(Suffix? = nil, Parameters? = nil)
/// Represents the `jpx` subtype.
case jpx(Suffix? = nil, Parameters? = nil)
/// Represents the `jxr` subtype.
case jxr(Suffix? = nil, Parameters? = nil)
/// Represents the `jxrA` subtype.
case jxrA(Suffix? = nil, Parameters? = nil)
/// Represents the `jxrS` subtype.
case jxrS(Suffix? = nil, Parameters? = nil)
/// Represents the `jxs` subtype.
case jxs(Suffix? = nil, Parameters? = nil)
/// Represents the `jxsc` subtype.
case jxsc(Suffix? = nil, Parameters? = nil)
/// Represents the `jxsi` subtype.
case jxsi(Suffix? = nil, Parameters? = nil)
/// Represents the `jxss` subtype.
case jxss(Suffix? = nil, Parameters? = nil)
/// Represents the `ktx` subtype.
case ktx(Suffix? = nil, Parameters? = nil)
/// Represents the `ktx2` subtype.
case ktx2(Suffix? = nil, Parameters? = nil)
/// Represents the `naplps` subtype.
case naplps(Suffix? = nil, Parameters? = nil)
/// Represents the `png` subtype.
case png(Suffix? = nil, Parameters? = nil)
/// Represents the `pwg-raster` subtype.
case pwgRaster(Suffix? = nil, Parameters? = nil)
/// Represents the `svg` subtype.
case svg(Suffix? = nil, Parameters? = nil)
/// Represents the `t38` subtype.
case t38(Suffix? = nil, Parameters? = nil)
/// Represents the `tiff` subtype.
case tiff(Suffix? = nil, Parameters? = nil)
/// Represents the `tiff-fx` subtype.
case tiffFx(Suffix? = nil, Parameters? = nil)
/// Represents the `wmf` subtype.
case wmf(Suffix? = nil, Parameters? = nil)
/// Represents the `x-emf` subtype.
case xEmf(Suffix? = nil, Parameters? = nil)
/// Represents the `x-wmf` subtype.
case xWmf(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Image: CustomStringConvertible {
public var description: String { rawValue }
}
extension Image: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "aces": self = .aces(suffix, parameters)
case "avci": self = .avci(suffix, parameters)
case "avcs": self = .avcs(suffix, parameters)
case "avif": self = .avif(suffix, parameters)
case "bmp": self = .bmp(suffix, parameters)
case "cgm": self = .cgm(suffix, parameters)
case "dicom-rle": self = .dicomRle(suffix, parameters)
case "emf": self = .emf(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "fits": self = .fits(suffix, parameters)
case "g3fax": self = .g3fax(suffix, parameters)
case "gif": self = .gif(suffix, parameters)
case "heic": self = .heic(suffix, parameters)
case "heic-sequence": self = .heicSequence(suffix, parameters)
case "heif": self = .heif(suffix, parameters)
case "heif-sequence": self = .heifSequence(suffix, parameters)
case "hej2k": self = .hej2k(suffix, parameters)
case "hsj2": self = .hsj2(suffix, parameters)
case "ief": self = .ief(suffix, parameters)
case "jls": self = .jls(suffix, parameters)
case "jp2": self = .jp2(suffix, parameters)
case "jpeg": self = .jpeg(suffix, parameters)
case "jph": self = .jph(suffix, parameters)
case "jphc": self = .jphc(suffix, parameters)
case "jpm": self = .jpm(suffix, parameters)
case "jpx": self = .jpx(suffix, parameters)
case "jxr": self = .jxr(suffix, parameters)
case "jxrA": self = .jxrA(suffix, parameters)
case "jxrS": self = .jxrS(suffix, parameters)
case "jxs": self = .jxs(suffix, parameters)
case "jxsc": self = .jxsc(suffix, parameters)
case "jxsi": self = .jxsi(suffix, parameters)
case "jxss": self = .jxss(suffix, parameters)
case "ktx": self = .ktx(suffix, parameters)
case "ktx2": self = .ktx2(suffix, parameters)
case "naplps": self = .naplps(suffix, parameters)
case "png": self = .png(suffix, parameters)
case "pwg-raster": self = .pwgRaster(suffix, parameters)
case "svg": self = .svg(suffix, parameters)
case "t38": self = .t38(suffix, parameters)
case "tiff": self = .tiff(suffix, parameters)
case "tiff-fx": self = .tiffFx(suffix, parameters)
case "wmf": self = .wmf(suffix, parameters)
case "x-emf": self = .xEmf(suffix, parameters)
case "x-wmf": self = .xWmf(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .aces(let suffix, let parameters): return "aces\(suffix)\(parameters)"
case .avci(let suffix, let parameters): return "avci\(suffix)\(parameters)"
case .avcs(let suffix, let parameters): return "avcs\(suffix)\(parameters)"
case .avif(let suffix, let parameters): return "avif\(suffix)\(parameters)"
case .bmp(let suffix, let parameters): return "bmp\(suffix)\(parameters)"
case .cgm(let suffix, let parameters): return "cgm\(suffix)\(parameters)"
case .dicomRle(let suffix, let parameters): return "dicom-rle\(suffix)\(parameters)"
case .emf(let suffix, let parameters): return "emf\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .fits(let suffix, let parameters): return "fits\(suffix)\(parameters)"
case .g3fax(let suffix, let parameters): return "g3fax\(suffix)\(parameters)"
case .gif(let suffix, let parameters): return "gif\(suffix)\(parameters)"
case .heic(let suffix, let parameters): return "heic\(suffix)\(parameters)"
case .heicSequence(let suffix, let parameters): return "heic-sequence\(suffix)\(parameters)"
case .heif(let suffix, let parameters): return "heif\(suffix)\(parameters)"
case .heifSequence(let suffix, let parameters): return "heif-sequence\(suffix)\(parameters)"
case .hej2k(let suffix, let parameters): return "hej2k\(suffix)\(parameters)"
case .hsj2(let suffix, let parameters): return "hsj2\(suffix)\(parameters)"
case .ief(let suffix, let parameters): return "ief\(suffix)\(parameters)"
case .jls(let suffix, let parameters): return "jls\(suffix)\(parameters)"
case .jp2(let suffix, let parameters): return "jp2\(suffix)\(parameters)"
case .jpeg(let suffix, let parameters): return "jpeg\(suffix)\(parameters)"
case .jph(let suffix, let parameters): return "jph\(suffix)\(parameters)"
case .jphc(let suffix, let parameters): return "jphc\(suffix)\(parameters)"
case .jpm(let suffix, let parameters): return "jpm\(suffix)\(parameters)"
case .jpx(let suffix, let parameters): return "jpx\(suffix)\(parameters)"
case .jxr(let suffix, let parameters): return "jxr\(suffix)\(parameters)"
case .jxrA(let suffix, let parameters): return "jxrA\(suffix)\(parameters)"
case .jxrS(let suffix, let parameters): return "jxrS\(suffix)\(parameters)"
case .jxs(let suffix, let parameters): return "jxs\(suffix)\(parameters)"
case .jxsc(let suffix, let parameters): return "jxsc\(suffix)\(parameters)"
case .jxsi(let suffix, let parameters): return "jxsi\(suffix)\(parameters)"
case .jxss(let suffix, let parameters): return "jxss\(suffix)\(parameters)"
case .ktx(let suffix, let parameters): return "ktx\(suffix)\(parameters)"
case .ktx2(let suffix, let parameters): return "ktx2\(suffix)\(parameters)"
case .naplps(let suffix, let parameters): return "naplps\(suffix)\(parameters)"
case .png(let suffix, let parameters): return "png\(suffix)\(parameters)"
case .pwgRaster(let suffix, let parameters): return "pwg-raster\(suffix)\(parameters)"
case .svg(let suffix, let parameters): return "svg\(suffix)\(parameters)"
case .t38(let suffix, let parameters): return "t38\(suffix)\(parameters)"
case .tiff(let suffix, let parameters): return "tiff\(suffix)\(parameters)"
case .tiffFx(let suffix, let parameters): return "tiff-fx\(suffix)\(parameters)"
case .wmf(let suffix, let parameters): return "wmf\(suffix)\(parameters)"
case .xEmf(let suffix, let parameters): return "x-emf\(suffix)\(parameters)"
case .xWmf(let suffix, let parameters): return "x-wmf\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Image: MediaSubtype { public var type: MediaType { .image(self) } }
extension Image: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .aces(let lhsSuffix, let lhsParameters):
guard case let .aces(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .avci(let lhsSuffix, let lhsParameters):
guard case let .avci(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .avcs(let lhsSuffix, let lhsParameters):
guard case let .avcs(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .avif(let lhsSuffix, let lhsParameters):
guard case let .avif(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .bmp(let lhsSuffix, let lhsParameters):
guard case let .bmp(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .cgm(let lhsSuffix, let lhsParameters):
guard case let .cgm(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .dicomRle(let lhsSuffix, let lhsParameters):
guard case let .dicomRle(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .emf(let lhsSuffix, let lhsParameters):
guard case let .emf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .fits(let lhsSuffix, let lhsParameters):
guard case let .fits(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .g3fax(let lhsSuffix, let lhsParameters):
guard case let .g3fax(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .gif(let lhsSuffix, let lhsParameters):
guard case let .gif(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .heic(let lhsSuffix, let lhsParameters):
guard case let .heic(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .heicSequence(let lhsSuffix, let lhsParameters):
guard case let .heicSequence(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .heif(let lhsSuffix, let lhsParameters):
guard case let .heif(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .heifSequence(let lhsSuffix, let lhsParameters):
guard case let .heifSequence(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .hej2k(let lhsSuffix, let lhsParameters):
guard case let .hej2k(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .hsj2(let lhsSuffix, let lhsParameters):
guard case let .hsj2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ief(let lhsSuffix, let lhsParameters):
guard case let .ief(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jls(let lhsSuffix, let lhsParameters):
guard case let .jls(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jp2(let lhsSuffix, let lhsParameters):
guard case let .jp2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jpeg(let lhsSuffix, let lhsParameters):
guard case let .jpeg(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jph(let lhsSuffix, let lhsParameters):
guard case let .jph(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jphc(let lhsSuffix, let lhsParameters):
guard case let .jphc(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jpm(let lhsSuffix, let lhsParameters):
guard case let .jpm(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jpx(let lhsSuffix, let lhsParameters):
guard case let .jpx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxr(let lhsSuffix, let lhsParameters):
guard case let .jxr(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxrA(let lhsSuffix, let lhsParameters):
guard case let .jxrA(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxrS(let lhsSuffix, let lhsParameters):
guard case let .jxrS(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxs(let lhsSuffix, let lhsParameters):
guard case let .jxs(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxsc(let lhsSuffix, let lhsParameters):
guard case let .jxsc(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxsi(let lhsSuffix, let lhsParameters):
guard case let .jxsi(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxss(let lhsSuffix, let lhsParameters):
guard case let .jxss(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ktx(let lhsSuffix, let lhsParameters):
guard case let .ktx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ktx2(let lhsSuffix, let lhsParameters):
guard case let .ktx2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .naplps(let lhsSuffix, let lhsParameters):
guard case let .naplps(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .png(let lhsSuffix, let lhsParameters):
guard case let .png(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .pwgRaster(let lhsSuffix, let lhsParameters):
guard case let .pwgRaster(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .svg(let lhsSuffix, let lhsParameters):
guard case let .svg(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .t38(let lhsSuffix, let lhsParameters):
guard case let .t38(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .tiff(let lhsSuffix, let lhsParameters):
guard case let .tiff(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .tiffFx(let lhsSuffix, let lhsParameters):
guard case let .tiffFx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .wmf(let lhsSuffix, let lhsParameters):
guard case let .wmf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .xEmf(let lhsSuffix, let lhsParameters):
guard case let .xEmf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .xWmf(let lhsSuffix, let lhsParameters):
guard case let .xWmf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .aces(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .avci(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .avcs(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .avif(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .bmp(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .cgm(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .dicomRle(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .emf(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .fits(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .g3fax(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .gif(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .heic(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .heicSequence(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .heif(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .heifSequence(let suffix, let parameters):
hasher.combine(15)
hasher.combine(suffix)
hasher.combine(parameters)
case .hej2k(let suffix, let parameters):
hasher.combine(16)
hasher.combine(suffix)
hasher.combine(parameters)
case .hsj2(let suffix, let parameters):
hasher.combine(17)
hasher.combine(suffix)
hasher.combine(parameters)
case .ief(let suffix, let parameters):
hasher.combine(18)
hasher.combine(suffix)
hasher.combine(parameters)
case .jls(let suffix, let parameters):
hasher.combine(19)
hasher.combine(suffix)
hasher.combine(parameters)
case .jp2(let suffix, let parameters):
hasher.combine(20)
hasher.combine(suffix)
hasher.combine(parameters)
case .jpeg(let suffix, let parameters):
hasher.combine(21)
hasher.combine(suffix)
hasher.combine(parameters)
case .jph(let suffix, let parameters):
hasher.combine(22)
hasher.combine(suffix)
hasher.combine(parameters)
case .jphc(let suffix, let parameters):
hasher.combine(23)
hasher.combine(suffix)
hasher.combine(parameters)
case .jpm(let suffix, let parameters):
hasher.combine(24)
hasher.combine(suffix)
hasher.combine(parameters)
case .jpx(let suffix, let parameters):
hasher.combine(25)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxr(let suffix, let parameters):
hasher.combine(26)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxrA(let suffix, let parameters):
hasher.combine(27)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxrS(let suffix, let parameters):
hasher.combine(28)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxs(let suffix, let parameters):
hasher.combine(29)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxsc(let suffix, let parameters):
hasher.combine(30)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxsi(let suffix, let parameters):
hasher.combine(31)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxss(let suffix, let parameters):
hasher.combine(32)
hasher.combine(suffix)
hasher.combine(parameters)
case .ktx(let suffix, let parameters):
hasher.combine(33)
hasher.combine(suffix)
hasher.combine(parameters)
case .ktx2(let suffix, let parameters):
hasher.combine(34)
hasher.combine(suffix)
hasher.combine(parameters)
case .naplps(let suffix, let parameters):
hasher.combine(35)
hasher.combine(suffix)
hasher.combine(parameters)
case .png(let suffix, let parameters):
hasher.combine(36)
hasher.combine(suffix)
hasher.combine(parameters)
case .pwgRaster(let suffix, let parameters):
hasher.combine(37)
hasher.combine(suffix)
hasher.combine(parameters)
case .svg(let suffix, let parameters):
hasher.combine(38)
hasher.combine(suffix)
hasher.combine(parameters)
case .t38(let suffix, let parameters):
hasher.combine(39)
hasher.combine(suffix)
hasher.combine(parameters)
case .tiff(let suffix, let parameters):
hasher.combine(40)
hasher.combine(suffix)
hasher.combine(parameters)
case .tiffFx(let suffix, let parameters):
hasher.combine(41)
hasher.combine(suffix)
hasher.combine(parameters)
case .wmf(let suffix, let parameters):
hasher.combine(42)
hasher.combine(suffix)
hasher.combine(parameters)
case .xEmf(let suffix, let parameters):
hasher.combine(43)
hasher.combine(suffix)
hasher.combine(parameters)
case .xWmf(let suffix, let parameters):
hasher.combine(44)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,6 @@
import Foundation
/// :nodoc:
public protocol MediaSubtype {
var type: MediaType { get }
}

View File

@ -0,0 +1,247 @@
import Foundation
/// A type-safe representation of [Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)s
/// (or formerly known as MIME types).
///
/// You can create a media type in a type-safe manner using one of the possible cases. You can also create
/// media type instances simply using string literals.
///
/// ```swift
/// let mediaType: MediaType = "application/json" // is equivalent to
/// MediaType.application(.json())
/// ```
///
/// Media type suffixes and parameters are supported both via string literals and ``MediaType`` cases.
///
/// ```swift
/// let mediaType: MediaType = "application/atom; charset=utf-8" // is equivalent to
/// MediaType.application(.atom(nil, ["charset": "utf-8"]))
///
/// let mediaType: MediaType = "application/atom+xml" // is equivalent to
/// MediaType.application(.atom(.xml))
///
/// let mediaType: MediaType = "application/atom+xml; charset=utf-8" // is equivalent to
/// MediaType.application(.atom(.xml, ["charset": "utf-8"]))
/// ```
///
/// You can create media type trees using either the string literal syntax, or using the `other` case of a particular
/// media type.
///
/// ```swift
/// "application/vnd.efi.img" // is equivalent to
/// MediaType.application(.other("vnd.efi.img"))
/// ```
public enum MediaType {
/// Represents the `application` media type.
///
/// Represents binary data. Common examples: `application/json`, `application/octet-stream`.
///
/// For the whole family of `application` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#application) documentation.
case application(Application)
/// Represents the `audio` media type.
///
/// Represents audible data. Common examples: `audio/ac3`, `audio/mpeg`.
///
/// For the whole family of `audio` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#audio) documentation.
case audio(Audio)
/// Represents the `font` media type.
///
/// Represents font or typeface data. Common examples: `font/woff`, `font/ttf`.
///
/// For the whole family of `font` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#font) documentation.
case font(Font)
/// Represents the `image` media type.
///
/// Represents image or graphical data. This includes bitmap and vector images, along with animated image formats.
/// Common examples: `image/jpeg`, `image/apng`.
///
/// For the whole family of `image` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#image) documentation.
case image(Image)
/// Represents the `message` media type.
///
/// Represents embedded message data. Common examples: `message/rfc882`, `message/http`.
///
/// For the whole family of `message` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#message) documentation.
case message(Message)
/// Represents the `model` media type.
///
/// Represents 3D modelling data. Common examples: `model/step`, `model/3mf`.
///
/// For the whole family of `model` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#model) documentation.
case model(Model)
/// Represents the `multipart` media type.
///
/// Represents data formed from multiple components, which may have their individual media types.
/// Common examples: `multipart/form-data`, `multipart/encrypted`.
///
/// For the whole family of `multipart` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#multipart) documentation.
case multipart(Multipart)
/// Represents the `text` media type.
///
/// Represents textual only data. Common examples: `text/css`, `text/html`.
///
/// For the whole family of `text` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#text) documentation.
case text(Text)
/// Represents the `video` media type.
///
/// Represents video data. Common examples: `video/mp4`, `video/H264`.
///
/// For the whole family of `video` media types consult the
/// [official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#video) documentation.
case video(Video)
/// Represents a custom media type that is currently not officially defined.
///
/// Represents a custom media type with the given `type` and `subtype`. Optionally, you can specify a ``Suffix`` and
/// ``Parameters``.
case other(type: CustomStringConvertible, subtype: CustomStringConvertible, Suffix? = nil, Parameters? = nil)
/// Represents a wildcard media type.
///
/// A wildcard media type has a type of `*`. A few examples:
///
/// ```swift
/// MediaType.anything(.anything()) // Creates: */*
/// MediaType.anything(.other("dialog")) // Creates: */dialog
/// MediaType.anything(.other("response", .xml)) // Creates: */response+xml
/// ```
case anything(Anything)
}
extension MediaType: CustomStringConvertible {
/// The textual representation of the media type.
///
/// The string form of a media type follows the pattern: `type/subtype[+suffix][;parameters]`. A few examples:
///
/// ```swift
/// MediaType.text(.css()).description // Outputs: text/css
/// MediaType.audio(.ac3(nil, ["rate": 32000])).description // Outputs: audio/ac3;rate=32000
/// MediaType.application(.atom(.xml, ["charset": "utf-8"])).description // Outputs: application/atom+xml;charset=utf-8
/// ```
public var description: String { rawValue }
}
extension MediaType: RawRepresentable {
/// Creates a media type from its raw string value.
///
/// - Parameter rawValue: The raw string value.
public init(rawValue: String) {
let chunks = rawValue.split(separator: "/", maxSplits: 1)
let rawType = String(chunks.first ?? "*")
let rawSubtype = String(chunks.count > 1 ? chunks[1] : "")
let (subtype, suffix, parameters) = convert(string: rawSubtype)
switch rawType {
case "application": self = .application(Application(rawValue: rawSubtype))
case "audio": self = .audio(Audio(rawValue: rawSubtype))
case "font": self = .font(Font(rawValue: rawSubtype))
case "image": self = .image(Image(rawValue: rawSubtype))
case "message": self = .message(Message(rawValue: rawSubtype))
case "model": self = .model(Model(rawValue: rawSubtype))
case "multipart": self = .multipart(Multipart(rawValue: rawSubtype))
case "text": self = .text(Text(rawValue: rawSubtype))
case "video": self = .video(Video(rawValue: rawSubtype))
case "*": self = .anything(Anything(rawValue: rawSubtype))
default: self = .other(type: rawType, subtype: subtype, suffix, parameters)
}
}
/// The raw string value of the media type.
public var rawValue: String {
switch self {
case .application(let subtype): return "application/\(subtype)"
case .audio(let subtype): return "audio/\(subtype)"
case .font(let subtype): return "font/\(subtype)"
case .image(let subtype): return "image/\(subtype)"
case .message(let subtype): return "message/\(subtype)"
case .model(let subtype): return "model/\(subtype)"
case .multipart(let subtype): return "multipart/\(subtype)"
case .text(let subtype): return "text/\(subtype)"
case .video(let subtype): return "video/\(subtype)"
case .other(let type, let subtype, let suffix, let parameters):return "\(type)/\(subtype)\(suffix)\(parameters)"
case .anything(let anything): return "*/\(anything)"
}
}
}
extension MediaType: ExpressibleByStringLiteral {
/// Creates a media type from a string literal.
///
/// Do not call this initializer directly. This rather allows you to use a string literal where you have to provide
/// a ``MediaType`` node.
public init(stringLiteral value: String) { self.init(rawValue: value) }
}
extension MediaType: Hashable {
/// Returns a Boolean indicating whether two media types are the same.
///
/// Two media types represent the same thing, and thus considered to be equal, if they have the same type, subtype,
/// ``Suffix`` and ``Parameters``.
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .application(let lhs): if case let .application(rhs) = rhs { return lhs == rhs } else { return false }
case .audio(let lhs): if case let .audio(rhs) = rhs { return lhs == rhs } else { return false }
case .font(let lhs): if case let .font(rhs) = rhs { return lhs == rhs } else { return false }
case .image(let lhs): if case let .image(rhs) = rhs { return lhs == rhs } else { return false }
case .message(let lhs): if case let .message(rhs) = rhs { return lhs == rhs } else { return false }
case .model(let lhs): if case let .model(rhs) = rhs { return lhs == rhs } else { return false }
case .multipart(let lhs): if case let .multipart(rhs) = rhs { return lhs == rhs } else { return false }
case .text(let lhs): if case let .text(rhs) = rhs { return lhs == rhs } else { return false }
case .video(let lhs): if case let .video(rhs) = rhs { return lhs == rhs } else { return false }
case .anything(let lhs): if case let .anything(rhs) = rhs { return lhs == rhs } else { return false }
case .other(let lhsType, let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsType, rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if (lhsType.description != rhsType.description) { return false }
if (lhsSubtype.description != rhsSubtype.description) { return false }
if (lhsSuffix != rhsSuffix) { return false }
if (lhsParameters != rhsParameters) { return false }
return true
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .application(let subtype):
hasher.combine(0)
hasher.combine(subtype)
case .audio(let subtype):
hasher.combine(1)
hasher.combine(subtype)
case .font(let subtype):
hasher.combine(2)
hasher.combine(subtype)
case .image(let subtype):
hasher.combine(3)
hasher.combine(subtype)
case .message(let subtype):
hasher.combine(4)
hasher.combine(subtype)
case .model(let subtype):
hasher.combine(5)
hasher.combine(subtype)
case .multipart(let subtype):
hasher.combine(6)
hasher.combine(subtype)
case .text(let subtype):
hasher.combine(7)
hasher.combine(subtype)
case .video(let subtype):
hasher.combine(8)
hasher.combine(subtype)
case .anything(let subtype):
hasher.combine(-1)
hasher.combine(subtype)
case .other(let type, let subtype, let suffix, let parameters):
hasher.combine(-2)
hasher.combine(type.description)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,322 @@
import Foundation
/// Represents the `message` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#message) for details.
///
/// You typically use ``Message`` as a ``MediaType``.
///
/// ```swift
/// let message = Message.http()
/// let mediaType = MediaType.message(message) // Creates: message/http
/// ```
///
/// You can use standard `switch` statement to access message values.
///
/// ```swift
/// func isSupported(message: Message) -> Bool {
/// switch message {
/// case .http, .rfc822: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .http()) // Returns: true
/// isSupported(audio: .rfc822()) // Returns: true
/// isSupported(audio: .sip()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Message {
/// Represents the `CPIM` subtype.
case CPIM(Suffix? = nil, Parameters? = nil)
/// Represents the `delivery-status` subtype.
case deliveryStatus(Suffix? = nil, Parameters? = nil)
/// Represents the `disposition-notification` subtype.
case dispositionNotification(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `external-body` subtype.
case externalBody(Suffix? = nil, Parameters? = nil)
/// Represents the `feedback-report` subtype.
case feedbackReport(Suffix? = nil, Parameters? = nil)
/// Represents the `global` subtype.
case global(Suffix? = nil, Parameters? = nil)
/// Represents the `global-delivery-status` subtype.
case globalDeliveryStatus(Suffix? = nil, Parameters? = nil)
/// Represents the `global-disposition-notification` subtype.
case globalDispositionNotification(Suffix? = nil, Parameters? = nil)
/// Represents the `global-headers` subtype.
case globalHeaders(Suffix? = nil, Parameters? = nil)
/// Represents the `http` subtype.
case http(Suffix? = nil, Parameters? = nil)
/// Represents the `imdn` subtype.
case imdn(Suffix? = nil, Parameters? = nil)
/// Represents the `news` subtype.
case news(Suffix? = nil, Parameters? = nil)
/// Represents the `partial` subtype.
case partial(Suffix? = nil, Parameters? = nil)
/// Represents the `rfc822` subtype.
case rfc822(Suffix? = nil, Parameters? = nil)
/// Represents the `s-http` subtype.
case sHttp(Suffix? = nil, Parameters? = nil)
/// Represents the `sip` subtype.
case sip(Suffix? = nil, Parameters? = nil)
/// Represents the `sipfrag` subtype.
case sipfrag(Suffix? = nil, Parameters? = nil)
/// Represents the `tracking-status` subtype.
case trackingStatus(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Message: CustomStringConvertible {
public var description: String { rawValue }
}
extension Message: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "CPIM": self = .CPIM(suffix, parameters)
case "delivery-status": self = .deliveryStatus(suffix, parameters)
case "disposition-notification": self = .dispositionNotification(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "external-body": self = .externalBody(suffix, parameters)
case "feedback-report": self = .feedbackReport(suffix, parameters)
case "global": self = .global(suffix, parameters)
case "global-delivery-status": self = .globalDeliveryStatus(suffix, parameters)
case "global-disposition-notification": self = .globalDispositionNotification(suffix, parameters)
case "global-headers": self = .globalHeaders(suffix, parameters)
case "http": self = .http(suffix, parameters)
case "imdn": self = .imdn(suffix, parameters)
case "news": self = .news(suffix, parameters)
case "partial": self = .partial(suffix, parameters)
case "rfc822": self = .rfc822(suffix, parameters)
case "s-http": self = .sHttp(suffix, parameters)
case "sip": self = .sip(suffix, parameters)
case "sipfrag": self = .sipfrag(suffix, parameters)
case "tracking-status": self = .trackingStatus(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .CPIM(let suffix, let parameters): return "CPIM\(suffix)\(parameters)"
case .deliveryStatus(let suffix, let parameters): return "delivery-status\(suffix)\(parameters)"
case .dispositionNotification(let suffix, let parameters): return "disposition-notification\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .externalBody(let suffix, let parameters): return "external-body\(suffix)\(parameters)"
case .feedbackReport(let suffix, let parameters): return "feedback-report\(suffix)\(parameters)"
case .global(let suffix, let parameters): return "global\(suffix)\(parameters)"
case .globalDeliveryStatus(let suffix, let parameters): return "global-delivery-status\(suffix)\(parameters)"
case .globalDispositionNotification(let suffix, let parameters): return "global-disposition-notification\(suffix)\(parameters)"
case .globalHeaders(let suffix, let parameters): return "global-headers\(suffix)\(parameters)"
case .http(let suffix, let parameters): return "http\(suffix)\(parameters)"
case .imdn(let suffix, let parameters): return "imdn\(suffix)\(parameters)"
case .news(let suffix, let parameters): return "news\(suffix)\(parameters)"
case .partial(let suffix, let parameters): return "partial\(suffix)\(parameters)"
case .rfc822(let suffix, let parameters): return "rfc822\(suffix)\(parameters)"
case .sHttp(let suffix, let parameters): return "s-http\(suffix)\(parameters)"
case .sip(let suffix, let parameters): return "sip\(suffix)\(parameters)"
case .sipfrag(let suffix, let parameters): return "sipfrag\(suffix)\(parameters)"
case .trackingStatus(let suffix, let parameters): return "tracking-status\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Message: MediaSubtype { public var type: MediaType { .message(self) } }
extension Message: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .CPIM(let lhsSuffix, let lhsParameters):
guard case let .CPIM(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .deliveryStatus(let lhsSuffix, let lhsParameters):
guard case let .deliveryStatus(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .dispositionNotification(let lhsSuffix, let lhsParameters):
guard case let .dispositionNotification(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .externalBody(let lhsSuffix, let lhsParameters):
guard case let .externalBody(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .feedbackReport(let lhsSuffix, let lhsParameters):
guard case let .feedbackReport(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .global(let lhsSuffix, let lhsParameters):
guard case let .global(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .globalDeliveryStatus(let lhsSuffix, let lhsParameters):
guard case let .globalDeliveryStatus(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .globalDispositionNotification(let lhsSuffix, let lhsParameters):
guard case let .globalDispositionNotification(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .globalHeaders(let lhsSuffix, let lhsParameters):
guard case let .globalHeaders(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .http(let lhsSuffix, let lhsParameters):
guard case let .http(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .imdn(let lhsSuffix, let lhsParameters):
guard case let .imdn(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .news(let lhsSuffix, let lhsParameters):
guard case let .news(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .partial(let lhsSuffix, let lhsParameters):
guard case let .partial(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rfc822(let lhsSuffix, let lhsParameters):
guard case let .rfc822(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .sHttp(let lhsSuffix, let lhsParameters):
guard case let .sHttp(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .sip(let lhsSuffix, let lhsParameters):
guard case let .sip(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .sipfrag(let lhsSuffix, let lhsParameters):
guard case let .sipfrag(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .trackingStatus(let lhsSuffix, let lhsParameters):
guard case let .trackingStatus(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .CPIM(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .deliveryStatus(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .dispositionNotification(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .externalBody(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .feedbackReport(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .global(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .globalDeliveryStatus(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .globalDispositionNotification(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .globalHeaders(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .http(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .imdn(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .news(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .partial(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .rfc822(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .sHttp(let suffix, let parameters):
hasher.combine(15)
hasher.combine(suffix)
hasher.combine(parameters)
case .sip(let suffix, let parameters):
hasher.combine(16)
hasher.combine(suffix)
hasher.combine(parameters)
case .sipfrag(let suffix, let parameters):
hasher.combine(17)
hasher.combine(suffix)
hasher.combine(parameters)
case .trackingStatus(let suffix, let parameters):
hasher.combine(18)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,274 @@
import Foundation
/// Represents the `model` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#model) for details.
///
/// You typically use ``Model`` as a ``MediaType``.
///
/// ```swift
/// let model = Model.step()
/// let mediaType = MediaType.model(model) // Creates: model/step
/// ```
///
/// You can use standard `switch` statement to access model values.
///
/// ```swift
/// func isSupported(model: Model) -> Bool {
/// switch model {
/// case .step, .iges: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .step()) // Returns: true
/// isSupported(audio: .iges()) // Returns: true
/// isSupported(audio: .mesh()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Model {
/// Represents the `3mf` subtype.
case _3mf(Suffix? = nil, Parameters? = nil)
/// Represents the `e57` subtype.
case e57(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `gltf-binary` subtype.
case gltfBinary(Suffix? = nil, Parameters? = nil)
/// Represents the `gltf` subtype.
case gltf(Suffix? = nil, Parameters? = nil)
/// Represents the `iges` subtype.
case iges(Suffix? = nil, Parameters? = nil)
/// Represents the `mesh` subtype.
case mesh(Suffix? = nil, Parameters? = nil)
/// Represents the `mtl` subtype.
case mtl(Suffix? = nil, Parameters? = nil)
/// Represents the `obj` subtype.
case obj(Suffix? = nil, Parameters? = nil)
/// Represents the `step` subtype.
case step(Suffix? = nil, Parameters? = nil)
/// Represents the `step-xml` subtype.
case stepXml(Suffix? = nil, Parameters? = nil)
/// Represents the `stl` subtype.
case stl(Suffix? = nil, Parameters? = nil)
/// Represents the `vrml` subtype.
case vrml(Suffix? = nil, Parameters? = nil)
/// Represents the `x3d-vrml` subtype.
case x3dVrml(Suffix? = nil, Parameters? = nil)
/// Represents the `x3d` subtype.
case x3d(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Model: CustomStringConvertible {
public var description: String { rawValue }
}
extension Model: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "3mf": self = ._3mf(suffix, parameters)
case "e57": self = .e57(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "gltf-binary": self = .gltfBinary(suffix, parameters)
case "gltf": self = .gltf(suffix, parameters)
case "iges": self = .iges(suffix, parameters)
case "mesh": self = .mesh(suffix, parameters)
case "mtl": self = .mtl(suffix, parameters)
case "obj": self = .obj(suffix, parameters)
case "step": self = .step(suffix, parameters)
case "step-xml": self = .stepXml(suffix, parameters)
case "stl": self = .stl(suffix, parameters)
case "vrml": self = .vrml(suffix, parameters)
case "x3d-vrml": self = .x3dVrml(suffix, parameters)
case "x3d": self = .x3d(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case ._3mf(let suffix, let parameters): return "3mf\(suffix)\(parameters)"
case .e57(let suffix, let parameters): return "e57\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .gltfBinary(let suffix, let parameters): return "gltf-binary\(suffix)\(parameters)"
case .gltf(let suffix, let parameters): return "gltf\(suffix)\(parameters)"
case .iges(let suffix, let parameters): return "iges\(suffix)\(parameters)"
case .mesh(let suffix, let parameters): return "mesh\(suffix)\(parameters)"
case .mtl(let suffix, let parameters): return "mtl\(suffix)\(parameters)"
case .obj(let suffix, let parameters): return "obj\(suffix)\(parameters)"
case .step(let suffix, let parameters): return "step\(suffix)\(parameters)"
case .stepXml(let suffix, let parameters): return "step-xml\(suffix)\(parameters)"
case .stl(let suffix, let parameters): return "stl\(suffix)\(parameters)"
case .vrml(let suffix, let parameters): return "vrml\(suffix)\(parameters)"
case .x3dVrml(let suffix, let parameters): return "x3d-vrml\(suffix)\(parameters)"
case .x3d(let suffix, let parameters): return "x3d\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Model: MediaSubtype { public var type: MediaType { .model(self) } }
extension Model: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case ._3mf(let lhsSuffix, let lhsParameters):
guard case let ._3mf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .e57(let lhsSuffix, let lhsParameters):
guard case let .e57(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .gltfBinary(let lhsSuffix, let lhsParameters):
guard case let .gltfBinary(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .gltf(let lhsSuffix, let lhsParameters):
guard case let .gltf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .iges(let lhsSuffix, let lhsParameters):
guard case let .iges(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mesh(let lhsSuffix, let lhsParameters):
guard case let .mesh(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mtl(let lhsSuffix, let lhsParameters):
guard case let .mtl(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .obj(let lhsSuffix, let lhsParameters):
guard case let .obj(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .step(let lhsSuffix, let lhsParameters):
guard case let .step(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .stepXml(let lhsSuffix, let lhsParameters):
guard case let .stepXml(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .stl(let lhsSuffix, let lhsParameters):
guard case let .stl(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .vrml(let lhsSuffix, let lhsParameters):
guard case let .vrml(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .x3dVrml(let lhsSuffix, let lhsParameters):
guard case let .x3dVrml(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .x3d(let lhsSuffix, let lhsParameters):
guard case let .x3d(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case ._3mf(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .e57(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .gltfBinary(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .gltf(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .iges(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .mesh(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .mtl(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .obj(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .step(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .stepXml(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .stl(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .vrml(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .x3dVrml(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .x3d(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,286 @@
import Foundation
/// Represents the `multipart` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#multipart) for details.
///
/// You typically use ``Multipart`` as a ``MediaType``.
///
/// ```swift
/// let multipart = Multipart.formData()
/// let mediaType = MediaType.multipart(multipart) // Creates: multipart/form-data
/// ```
///
/// You can use standard `switch` statement to access multipart values.
///
/// ```swift
/// func isSupported(multipart: Multipart) -> Bool {
/// switch multipart {
/// case .formData, .mixed: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .formData()) // Returns: true
/// isSupported(audio: .mixed()) // Returns: true
/// isSupported(audio: .voiceMessage()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Multipart {
/// Represents the `alternative` subtype.
case alternative(Suffix? = nil, Parameters? = nil)
/// Represents the `appledouble` subtype.
case appledouble(Suffix? = nil, Parameters? = nil)
/// Represents the `byteranges` subtype.
case byteranges(Suffix? = nil, Parameters? = nil)
/// Represents the `digest` subtype.
case digest(Suffix? = nil, Parameters? = nil)
/// Represents the `encrypted` subtype.
case encrypted(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `form-data` subtype.
case formData(Suffix? = nil, Parameters? = nil)
/// Represents the `header-set` subtype.
case headerSet(Suffix? = nil, Parameters? = nil)
/// Represents the `mixed` subtype.
case mixed(Suffix? = nil, Parameters? = nil)
/// Represents the `multilingual` subtype.
case multilingual(Suffix? = nil, Parameters? = nil)
/// Represents the `parallel` subtype.
case parallel(Suffix? = nil, Parameters? = nil)
/// Represents the `related` subtype.
case related(Suffix? = nil, Parameters? = nil)
/// Represents the `report` subtype.
case report(Suffix? = nil, Parameters? = nil)
/// Represents the `signed` subtype.
case signed(Suffix? = nil, Parameters? = nil)
/// Represents the `voice-message` subtype.
case voiceMessage(Suffix? = nil, Parameters? = nil)
/// Represents the `x-mixed-replace` subtype.
case xMixedReplace(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Multipart: CustomStringConvertible {
public var description: String { rawValue }
}
extension Multipart: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "alternative": self = .alternative(suffix, parameters)
case "appledouble": self = .appledouble(suffix, parameters)
case "byteranges": self = .byteranges(suffix, parameters)
case "digest": self = .digest(suffix, parameters)
case "encrypted": self = .encrypted(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "form-data": self = .formData(suffix, parameters)
case "header-set": self = .headerSet(suffix, parameters)
case "mixed": self = .mixed(suffix, parameters)
case "multilingual": self = .multilingual(suffix, parameters)
case "parallel": self = .parallel(suffix, parameters)
case "related": self = .related(suffix, parameters)
case "report": self = .report(suffix, parameters)
case "signed": self = .signed(suffix, parameters)
case "voice-message": self = .voiceMessage(suffix, parameters)
case "x-mixed-replace": self = .xMixedReplace(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .alternative(let suffix, let parameters): return "alternative\(suffix)\(parameters)"
case .appledouble(let suffix, let parameters): return "appledouble\(suffix)\(parameters)"
case .byteranges(let suffix, let parameters): return "byteranges\(suffix)\(parameters)"
case .digest(let suffix, let parameters): return "digest\(suffix)\(parameters)"
case .encrypted(let suffix, let parameters): return "encrypted\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .formData(let suffix, let parameters): return "form-data\(suffix)\(parameters)"
case .headerSet(let suffix, let parameters): return "header-set\(suffix)\(parameters)"
case .mixed(let suffix, let parameters): return "mixed\(suffix)\(parameters)"
case .multilingual(let suffix, let parameters): return "multilingual\(suffix)\(parameters)"
case .parallel(let suffix, let parameters): return "parallel\(suffix)\(parameters)"
case .related(let suffix, let parameters): return "related\(suffix)\(parameters)"
case .report(let suffix, let parameters): return "report\(suffix)\(parameters)"
case .signed(let suffix, let parameters): return "signed\(suffix)\(parameters)"
case .voiceMessage(let suffix, let parameters): return "voice-message\(suffix)\(parameters)"
case .xMixedReplace(let suffix, let parameters): return "x-mixed-replace\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Multipart: MediaSubtype { public var type: MediaType { .multipart(self) } }
extension Multipart: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .alternative(let lhsSuffix, let lhsParameters):
guard case let .alternative(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .appledouble(let lhsSuffix, let lhsParameters):
guard case let .appledouble(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .byteranges(let lhsSuffix, let lhsParameters):
guard case let .byteranges(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .digest(let lhsSuffix, let lhsParameters):
guard case let .digest(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .encrypted(let lhsSuffix, let lhsParameters):
guard case let .encrypted(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .formData(let lhsSuffix, let lhsParameters):
guard case let .formData(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .headerSet(let lhsSuffix, let lhsParameters):
guard case let .headerSet(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mixed(let lhsSuffix, let lhsParameters):
guard case let .mixed(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .multilingual(let lhsSuffix, let lhsParameters):
guard case let .multilingual(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .parallel(let lhsSuffix, let lhsParameters):
guard case let .parallel(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .related(let lhsSuffix, let lhsParameters):
guard case let .related(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .report(let lhsSuffix, let lhsParameters):
guard case let .report(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .signed(let lhsSuffix, let lhsParameters):
guard case let .signed(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .voiceMessage(let lhsSuffix, let lhsParameters):
guard case let .voiceMessage(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .xMixedReplace(let lhsSuffix, let lhsParameters):
guard case let .xMixedReplace(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .alternative(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .appledouble(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .byteranges(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .digest(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .encrypted(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .formData(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .headerSet(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .mixed(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .multilingual(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .parallel(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .related(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .report(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .signed(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .voiceMessage(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .xMixedReplace(let suffix, let parameters):
hasher.combine(15)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,38 @@
import Foundation
/// Represents parameters of ``MediaType``s.
///
/// A media type may have parameters. For example `text/html;charset=utf-8` defines a media type with UTF-8 charset
/// instead of the default ASCII.
///
/// You can specify arbitrary parameters to *any* of the ``MediaType``s using a Swift
/// [dictionary](https://developer.apple.com/documentation/swift/dictionary). Keep in mind though, that not all such
/// parameter values are registered (see the
/// [official site](https://www.iana.org/assignments/media-types/media-types.xhtml) for details).
///
/// You can specify parameters by using either the Swift DSL or string literal syntax. Parameters in string variables
/// are also supported. The following examples are equivalent:
///
/// ```swift
/// let mediaType: MediaType = "audio/ac3;rate=32000" // is equivalent to
///
/// let mediaType = MediaType.audio(.ac3(nil, ["rate": 32_000])) // is equivalent to
///
/// let rawMediaType = "audio/ac3;rate=32000"
/// let mediaType = MediaType(rawValue: rawMediaType)
/// ```
public typealias Parameters = [String: CustomStringConvertible?]
internal extension DefaultStringInterpolation {
@inlinable mutating func appendInterpolation(_ value: Parameters?) {
guard let parameters = value else { return }
if parameters.isEmpty { return }
for (key, value) in parameters {
appendLiteral(";")
appendLiteral(key)
guard let value = value else { continue }
appendLiteral("=")
appendLiteral(value.description)
}
}
}

View File

@ -0,0 +1,170 @@
import Foundation
/// Represents the media type [suffix](https://en.wikipedia.org/wiki/Media_type#Suffix)es.
///
/// The library allows all ``MediaType``s to have a suffix. Keep in mind though, that not all such combinations are
/// registered (see the [official site](https://www.iana.org/assignments/media-types/media-types.xhtml) for details).
///
/// It is also possible to create completely custom suffixes by using either the ``Suffix/other(_:)`` case directly or a
/// string literal.
///
/// ```swift
/// MediaType.application(.jose(.json)) // Creates: application/jose+json
/// MediaType.application(.jose(.other("custom"))) // Creates: application/jose+custom
/// MediaType.image(.svg("zip")) // Creates: image/svg+zip
/// ```
///
/// You can access a media type's suffix by matching using a `switch` statement:
///
/// ```swift
/// let mediaType = MediaType.application(.calendar(.xml))
/// switch mediaType {
/// case .application(.calendar(let suffix, _)):
/// guard let suffix = suffix else { break }
/// print("Suffix: \(suffix)", "Suffix: +xml")
/// default:
/// print("Unsupported media type: \(mediaType)")
/// }
/// ```
public enum Suffix {
/// Represents the `xml` suffix.
case xml
/// Represents the `json` suffix.
case json
/// Represents the `ber` suffix.
case ber
/// Represents the `cbor` suffix.
case cbor
/// Represents the `der` suffix.
case der
/// Represents the `fastinfoset` suffix.
case fastinfoset
/// Represents the `wbxml` suffix.
case wbxml
/// Represents the `zip` suffix.
case zip
/// Represents the `tlv` suffix.
case tlv
/// Represents the `json-seq` suffix.
case jsonSeq
/// Represents the `sqlite3` suffix.
case sqlite3
/// Represents the `jwt` suffix.
case jwt
/// Represents the `gzip` suffix.
case gzip
/// Represents the `cbor-seq` suffix.
case cborSeq
/// Represents the `zstd` suffix.
case zstd
/// Represents a custom suffix.
case other(CustomStringConvertible)
}
extension Suffix: RawRepresentable {
public init(rawValue: String) {
let rawValue = rawValue.starts(with: "+")
? String(rawValue.split(separator: "+", maxSplits: 1).last!)
: rawValue
switch (rawValue) {
case "xml": self = .xml
case "json": self = .json
case "ber": self = .ber
case "cbor": self = .cbor
case "der": self = .der
case "fastinfoset": self = .fastinfoset
case "wbxml": self = .wbxml
case "zip": self = .zip
case "tlv": self = .tlv
case "json-seq": self = .jsonSeq
case "sqlite3": self = .sqlite3
case "jwt": self = .jwt
case "gzip": self = .gzip
case "cbor-seq": self = .cborSeq
case "zstd": self = .zstd
default: self = .other(rawValue)
}
}
public var rawValue: String {
switch self {
case .xml: return "+xml"
case .json: return "+json"
case .ber: return "+ber"
case .cbor: return "+cbor"
case .der: return "+der"
case .fastinfoset: return "+fastinfoset"
case .wbxml: return "+wbxml"
case .zip: return "+zip"
case .tlv: return "+tlv"
case .jsonSeq: return "+json-seq"
case .sqlite3: return "+sqlite3"
case .jwt: return "+jwt"
case .gzip: return "+gzip"
case .cborSeq: return "+cbor-seq"
case .zstd: return "+zstd"
case .other(let value): return value.description.starts(with: "+") ? value.description : "+\(value)"
}
}
}
extension Suffix: CustomStringConvertible { public var description: String { rawValue } }
extension Optional: CustomStringConvertible where Wrapped == Suffix {
public var description: String {
switch self {
case .none: return ""
case .some(let value): return value.description
}
}
}
extension Suffix: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(rawValue: value)
}
}
extension Suffix: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .xml: if case .xml = rhs { return true } else { return false }
case .json: if case .json = rhs { return true } else { return false }
case .ber: if case .ber = rhs { return true } else { return false }
case .cbor: if case .cbor = rhs { return true } else { return false }
case .der: if case .der = rhs { return true } else { return false }
case .fastinfoset: if case .fastinfoset = rhs { return true } else { return false }
case .wbxml: if case .wbxml = rhs { return true } else { return false }
case .zip: if case .zip = rhs { return true } else { return false }
case .tlv: if case .tlv = rhs { return true } else { return false }
case .jsonSeq: if case .jsonSeq = rhs { return true } else { return false }
case .sqlite3: if case .sqlite3 = rhs { return true } else { return false }
case .jwt: if case .jwt = rhs { return true } else { return false }
case .gzip: if case .gzip = rhs { return true } else { return false }
case .cborSeq: if case .cborSeq = rhs { return true } else { return false }
case .zstd: if case .zstd = rhs { return true } else { return false }
case .other(let lhsSuffix): if case let .other(rhsSuffix) = rhs { return lhsSuffix.description == rhsSuffix.description } else { return false }
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .xml: hasher.combine(0)
case .json: hasher.combine(1)
case .ber: hasher.combine(2)
case .cbor: hasher.combine(3)
case .der: hasher.combine(4)
case .fastinfoset: hasher.combine(5)
case .wbxml: hasher.combine(6)
case .zip: hasher.combine(7)
case .tlv: hasher.combine(8)
case .jsonSeq: hasher.combine(9)
case .sqlite3: hasher.combine(10)
case .jwt: hasher.combine(11)
case .gzip: hasher.combine(12)
case .cborSeq: hasher.combine(13)
case .zstd: hasher.combine(14)
case .other(let other): hasher.combine(other.description)
}
}
}

View File

@ -0,0 +1,730 @@
import Foundation
/// Represents the `text` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#text) for details.
///
/// You typically use ``Text`` as a ``MediaType``.
///
/// ```swift
/// let text = Text.html()
/// let mediaType = MediaType.text(text) // Creates: text/html
/// ```
///
/// You can use standard `switch` statement to access text values.
///
/// ```swift
/// func isSupported(text: Text) -> Bool {
/// switch text {
/// case .html, .css: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .html()) // Returns: true
/// isSupported(audio: .css()) // Returns: true
/// isSupported(audio: .javascript()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Text {
/// Represents the `1d-interleaved-parityfec` subtype.
case _1dInterleavedParityfec(Suffix? = nil, Parameters? = nil)
/// Represents the `cache-manifest` subtype.
case cacheManifest(Suffix? = nil, Parameters? = nil)
/// Represents the `calendar` subtype.
case calendar(Suffix? = nil, Parameters? = nil)
/// Represents the `cql` subtype.
case cql(Suffix? = nil, Parameters? = nil)
/// Represents the `cql-expression` subtype.
case cqlExpression(Suffix? = nil, Parameters? = nil)
/// Represents the `cql-identifier` subtype.
case cqlIdentifier(Suffix? = nil, Parameters? = nil)
/// Represents the `css` subtype.
case css(Suffix? = nil, Parameters? = nil)
/// Represents the `csv` subtype.
case csv(Suffix? = nil, Parameters? = nil)
/// Represents the `csv-schema` subtype.
case csvSchema(Suffix? = nil, Parameters? = nil)
/// Represents the `directory` subtype.
case directory(Suffix? = nil, Parameters? = nil)
/// Represents the `dns` subtype.
case dns(Suffix? = nil, Parameters? = nil)
/// Represents the `ecmascript` subtype.
case ecmascript(Suffix? = nil, Parameters? = nil)
/// Represents the `encaprtp` subtype.
case encaprtp(Suffix? = nil, Parameters? = nil)
/// Represents the `enriched` subtype.
case enriched(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `fhirpath` subtype.
case fhirpath(Suffix? = nil, Parameters? = nil)
/// Represents the `flexfec` subtype.
case flexfec(Suffix? = nil, Parameters? = nil)
/// Represents the `fwdred` subtype.
case fwdred(Suffix? = nil, Parameters? = nil)
/// Represents the `gff3` subtype.
case gff3(Suffix? = nil, Parameters? = nil)
/// Represents the `grammar-ref-list` subtype.
case grammarRefList(Suffix? = nil, Parameters? = nil)
/// Represents the `html` subtype.
case html(Suffix? = nil, Parameters? = nil)
/// Represents the `javascript` subtype.
case javascript(Suffix? = nil, Parameters? = nil)
/// Represents the `jcr-cnd` subtype.
case jcrCnd(Suffix? = nil, Parameters? = nil)
/// Represents the `markdown` subtype.
case markdown(Suffix? = nil, Parameters? = nil)
/// Represents the `mizar` subtype.
case mizar(Suffix? = nil, Parameters? = nil)
/// Represents the `n3` subtype.
case n3(Suffix? = nil, Parameters? = nil)
/// Represents the `parameters` subtype.
case parameters(Suffix? = nil, Parameters? = nil)
/// Represents the `parityfec` subtype.
case parityfec(Suffix? = nil, Parameters? = nil)
/// Represents the `plain` subtype.
case plain(Suffix? = nil, Parameters? = nil)
/// Represents the `provenance-notation` subtype.
case provenanceNotation(Suffix? = nil, Parameters? = nil)
/// Represents the `raptorfec` subtype.
case raptorfec(Suffix? = nil, Parameters? = nil)
/// Represents the `RED` subtype.
case RED(Suffix? = nil, Parameters? = nil)
/// Represents the `rfc822-headers` subtype.
case rfc822Headers(Suffix? = nil, Parameters? = nil)
/// Represents the `richtext` subtype.
case richtext(Suffix? = nil, Parameters? = nil)
/// Represents the `rtf` subtype.
case rtf(Suffix? = nil, Parameters? = nil)
/// Represents the `rtp-enc-aescm128` subtype.
case rtpEncAescm128(Suffix? = nil, Parameters? = nil)
/// Represents the `rtploopback` subtype.
case rtploopback(Suffix? = nil, Parameters? = nil)
/// Represents the `rtx` subtype.
case rtx(Suffix? = nil, Parameters? = nil)
/// Represents the `SGML` subtype.
case SGML(Suffix? = nil, Parameters? = nil)
/// Represents the `shaclc` subtype.
case shaclc(Suffix? = nil, Parameters? = nil)
/// Represents the `shex` subtype.
case shex(Suffix? = nil, Parameters? = nil)
/// Represents the `spdx` subtype.
case spdx(Suffix? = nil, Parameters? = nil)
/// Represents the `strings` subtype.
case strings(Suffix? = nil, Parameters? = nil)
/// Represents the `t140` subtype.
case t140(Suffix? = nil, Parameters? = nil)
/// Represents the `tab-separated-values` subtype.
case tabSeparatedValues(Suffix? = nil, Parameters? = nil)
/// Represents the `troff` subtype.
case troff(Suffix? = nil, Parameters? = nil)
/// Represents the `turtle` subtype.
case turtle(Suffix? = nil, Parameters? = nil)
/// Represents the `ulpfec` subtype.
case ulpfec(Suffix? = nil, Parameters? = nil)
/// Represents the `uri-list` subtype.
case uriList(Suffix? = nil, Parameters? = nil)
/// Represents the `vcard` subtype.
case vcard(Suffix? = nil, Parameters? = nil)
/// Represents the `vtt` subtype.
case vtt(Suffix? = nil, Parameters? = nil)
/// Represents the `xml` subtype.
case xml(Suffix? = nil, Parameters? = nil)
/// Represents the `xml-external-parsed-entity` subtype.
case xmlExternalParsedEntity(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Text: CustomStringConvertible {
public var description: String { rawValue }
}
extension Text: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "1d-interleaved-parityfec": self = ._1dInterleavedParityfec(suffix, parameters)
case "cache-manifest": self = .cacheManifest(suffix, parameters)
case "calendar": self = .calendar(suffix, parameters)
case "cql": self = .cql(suffix, parameters)
case "cql-expression": self = .cqlExpression(suffix, parameters)
case "cql-identifier": self = .cqlIdentifier(suffix, parameters)
case "css": self = .css(suffix, parameters)
case "csv": self = .csv(suffix, parameters)
case "csv-schema": self = .csvSchema(suffix, parameters)
case "directory": self = .directory(suffix, parameters)
case "dns": self = .dns(suffix, parameters)
case "ecmascript": self = .ecmascript(suffix, parameters)
case "encaprtp": self = .encaprtp(suffix, parameters)
case "enriched": self = .enriched(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "fhirpath": self = .fhirpath(suffix, parameters)
case "flexfec": self = .flexfec(suffix, parameters)
case "fwdred": self = .fwdred(suffix, parameters)
case "gff3": self = .gff3(suffix, parameters)
case "grammar-ref-list": self = .grammarRefList(suffix, parameters)
case "html": self = .html(suffix, parameters)
case "javascript": self = .javascript(suffix, parameters)
case "jcr-cnd": self = .jcrCnd(suffix, parameters)
case "markdown": self = .markdown(suffix, parameters)
case "mizar": self = .mizar(suffix, parameters)
case "n3": self = .n3(suffix, parameters)
case "parameters": self = .parameters(suffix, parameters)
case "parityfec": self = .parityfec(suffix, parameters)
case "plain": self = .plain(suffix, parameters)
case "provenance-notation": self = .provenanceNotation(suffix, parameters)
case "raptorfec": self = .raptorfec(suffix, parameters)
case "RED": self = .RED(suffix, parameters)
case "rfc822-headers": self = .rfc822Headers(suffix, parameters)
case "richtext": self = .richtext(suffix, parameters)
case "rtf": self = .rtf(suffix, parameters)
case "rtp-enc-aescm128": self = .rtpEncAescm128(suffix, parameters)
case "rtploopback": self = .rtploopback(suffix, parameters)
case "rtx": self = .rtx(suffix, parameters)
case "SGML": self = .SGML(suffix, parameters)
case "shaclc": self = .shaclc(suffix, parameters)
case "shex": self = .shex(suffix, parameters)
case "spdx": self = .spdx(suffix, parameters)
case "strings": self = .strings(suffix, parameters)
case "t140": self = .t140(suffix, parameters)
case "tab-separated-values": self = .tabSeparatedValues(suffix, parameters)
case "troff": self = .troff(suffix, parameters)
case "turtle": self = .turtle(suffix, parameters)
case "ulpfec": self = .ulpfec(suffix, parameters)
case "uri-list": self = .uriList(suffix, parameters)
case "vcard": self = .vcard(suffix, parameters)
case "vtt": self = .vtt(suffix, parameters)
case "xml": self = .xml(suffix, parameters)
case "xml-external-parsed-entity": self = .xmlExternalParsedEntity(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case ._1dInterleavedParityfec(let suffix, let parameters): return "1d-interleaved-parityfec\(suffix)\(parameters)"
case .cacheManifest(let suffix, let parameters): return "cache-manifest\(suffix)\(parameters)"
case .calendar(let suffix, let parameters): return "calendar\(suffix)\(parameters)"
case .cql(let suffix, let parameters): return "cql\(suffix)\(parameters)"
case .cqlExpression(let suffix, let parameters): return "cql-expression\(suffix)\(parameters)"
case .cqlIdentifier(let suffix, let parameters): return "cql-identifier\(suffix)\(parameters)"
case .css(let suffix, let parameters): return "css\(suffix)\(parameters)"
case .csv(let suffix, let parameters): return "csv\(suffix)\(parameters)"
case .csvSchema(let suffix, let parameters): return "csv-schema\(suffix)\(parameters)"
case .directory(let suffix, let parameters): return "directory\(suffix)\(parameters)"
case .dns(let suffix, let parameters): return "dns\(suffix)\(parameters)"
case .ecmascript(let suffix, let parameters): return "ecmascript\(suffix)\(parameters)"
case .encaprtp(let suffix, let parameters): return "encaprtp\(suffix)\(parameters)"
case .enriched(let suffix, let parameters): return "enriched\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .fhirpath(let suffix, let parameters): return "fhirpath\(suffix)\(parameters)"
case .flexfec(let suffix, let parameters): return "flexfec\(suffix)\(parameters)"
case .fwdred(let suffix, let parameters): return "fwdred\(suffix)\(parameters)"
case .gff3(let suffix, let parameters): return "gff3\(suffix)\(parameters)"
case .grammarRefList(let suffix, let parameters): return "grammar-ref-list\(suffix)\(parameters)"
case .html(let suffix, let parameters): return "html\(suffix)\(parameters)"
case .javascript(let suffix, let parameters): return "javascript\(suffix)\(parameters)"
case .jcrCnd(let suffix, let parameters): return "jcr-cnd\(suffix)\(parameters)"
case .markdown(let suffix, let parameters): return "markdown\(suffix)\(parameters)"
case .mizar(let suffix, let parameters): return "mizar\(suffix)\(parameters)"
case .n3(let suffix, let parameters): return "n3\(suffix)\(parameters)"
case .parameters(let suffix, let parameters): return "parameters\(suffix)\(parameters)"
case .parityfec(let suffix, let parameters): return "parityfec\(suffix)\(parameters)"
case .plain(let suffix, let parameters): return "plain\(suffix)\(parameters)"
case .provenanceNotation(let suffix, let parameters): return "provenance-notation\(suffix)\(parameters)"
case .raptorfec(let suffix, let parameters): return "raptorfec\(suffix)\(parameters)"
case .RED(let suffix, let parameters): return "RED\(suffix)\(parameters)"
case .rfc822Headers(let suffix, let parameters): return "rfc822-headers\(suffix)\(parameters)"
case .richtext(let suffix, let parameters): return "richtext\(suffix)\(parameters)"
case .rtf(let suffix, let parameters): return "rtf\(suffix)\(parameters)"
case .rtpEncAescm128(let suffix, let parameters): return "rtp-enc-aescm128\(suffix)\(parameters)"
case .rtploopback(let suffix, let parameters): return "rtploopback\(suffix)\(parameters)"
case .rtx(let suffix, let parameters): return "rtx\(suffix)\(parameters)"
case .SGML(let suffix, let parameters): return "SGML\(suffix)\(parameters)"
case .shaclc(let suffix, let parameters): return "shaclc\(suffix)\(parameters)"
case .shex(let suffix, let parameters): return "shex\(suffix)\(parameters)"
case .spdx(let suffix, let parameters): return "spdx\(suffix)\(parameters)"
case .strings(let suffix, let parameters): return "strings\(suffix)\(parameters)"
case .t140(let suffix, let parameters): return "t140\(suffix)\(parameters)"
case .tabSeparatedValues(let suffix, let parameters): return "tab-separated-values\(suffix)\(parameters)"
case .troff(let suffix, let parameters): return "troff\(suffix)\(parameters)"
case .turtle(let suffix, let parameters): return "turtle\(suffix)\(parameters)"
case .ulpfec(let suffix, let parameters): return "ulpfec\(suffix)\(parameters)"
case .uriList(let suffix, let parameters): return "uri-list\(suffix)\(parameters)"
case .vcard(let suffix, let parameters): return "vcard\(suffix)\(parameters)"
case .vtt(let suffix, let parameters): return "vtt\(suffix)\(parameters)"
case .xml(let suffix, let parameters): return "xml\(suffix)\(parameters)"
case .xmlExternalParsedEntity(let suffix, let parameters): return "xml-external-parsed-entity\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Text: MediaSubtype { public var type: MediaType { .text(self) } }
extension Text: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .RED(let lhsSuffix, let lhsParameters):
guard case let .RED(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .SGML(let lhsSuffix, let lhsParameters):
guard case let .SGML(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case ._1dInterleavedParityfec(let lhsSuffix, let lhsParameters):
guard case let ._1dInterleavedParityfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .cacheManifest(let lhsSuffix, let lhsParameters):
guard case let .cacheManifest(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .calendar(let lhsSuffix, let lhsParameters):
guard case let .calendar(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .cql(let lhsSuffix, let lhsParameters):
guard case let .cql(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .cqlExpression(let lhsSuffix, let lhsParameters):
guard case let .cqlExpression(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .cqlIdentifier(let lhsSuffix, let lhsParameters):
guard case let .cqlIdentifier(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .css(let lhsSuffix, let lhsParameters):
guard case let .css(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .csv(let lhsSuffix, let lhsParameters):
guard case let .csv(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .csvSchema(let lhsSuffix, let lhsParameters):
guard case let .csvSchema(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .directory(let lhsSuffix, let lhsParameters):
guard case let .directory(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .dns(let lhsSuffix, let lhsParameters):
guard case let .dns(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ecmascript(let lhsSuffix, let lhsParameters):
guard case let .ecmascript(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .encaprtp(let lhsSuffix, let lhsParameters):
guard case let .encaprtp(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .enriched(let lhsSuffix, let lhsParameters):
guard case let .enriched(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .fhirpath(let lhsSuffix, let lhsParameters):
guard case let .fhirpath(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .flexfec(let lhsSuffix, let lhsParameters):
guard case let .flexfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .fwdred(let lhsSuffix, let lhsParameters):
guard case let .fwdred(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .gff3(let lhsSuffix, let lhsParameters):
guard case let .gff3(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .grammarRefList(let lhsSuffix, let lhsParameters):
guard case let .grammarRefList(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .html(let lhsSuffix, let lhsParameters):
guard case let .html(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .javascript(let lhsSuffix, let lhsParameters):
guard case let .javascript(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jcrCnd(let lhsSuffix, let lhsParameters):
guard case let .jcrCnd(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .markdown(let lhsSuffix, let lhsParameters):
guard case let .markdown(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mizar(let lhsSuffix, let lhsParameters):
guard case let .mizar(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .n3(let lhsSuffix, let lhsParameters):
guard case let .n3(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .parameters(let lhsSuffix, let lhsParameters):
guard case let .parameters(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .parityfec(let lhsSuffix, let lhsParameters):
guard case let .parityfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .plain(let lhsSuffix, let lhsParameters):
guard case let .plain(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .provenanceNotation(let lhsSuffix, let lhsParameters):
guard case let .provenanceNotation(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .raptorfec(let lhsSuffix, let lhsParameters):
guard case let .raptorfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rfc822Headers(let lhsSuffix, let lhsParameters):
guard case let .rfc822Headers(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .richtext(let lhsSuffix, let lhsParameters):
guard case let .richtext(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtf(let lhsSuffix, let lhsParameters):
guard case let .rtf(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtpEncAescm128(let lhsSuffix, let lhsParameters):
guard case let .rtpEncAescm128(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtploopback(let lhsSuffix, let lhsParameters):
guard case let .rtploopback(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtx(let lhsSuffix, let lhsParameters):
guard case let .rtx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .shaclc(let lhsSuffix, let lhsParameters):
guard case let .shaclc(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .shex(let lhsSuffix, let lhsParameters):
guard case let .shex(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .spdx(let lhsSuffix, let lhsParameters):
guard case let .spdx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .strings(let lhsSuffix, let lhsParameters):
guard case let .strings(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .t140(let lhsSuffix, let lhsParameters):
guard case let .t140(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .tabSeparatedValues(let lhsSuffix, let lhsParameters):
guard case let .tabSeparatedValues(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .troff(let lhsSuffix, let lhsParameters):
guard case let .troff(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .turtle(let lhsSuffix, let lhsParameters):
guard case let .turtle(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ulpfec(let lhsSuffix, let lhsParameters):
guard case let .ulpfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .uriList(let lhsSuffix, let lhsParameters):
guard case let .uriList(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .vcard(let lhsSuffix, let lhsParameters):
guard case let .vcard(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .vtt(let lhsSuffix, let lhsParameters):
guard case let .vtt(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .xml(let lhsSuffix, let lhsParameters):
guard case let .xml(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .xmlExternalParsedEntity(let lhsSuffix, let lhsParameters):
guard case let .xmlExternalParsedEntity(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .RED(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .SGML(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case ._1dInterleavedParityfec(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .cacheManifest(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .calendar(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .cql(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .cqlExpression(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .cqlIdentifier(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .css(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .csv(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .csvSchema(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .directory(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .dns(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .ecmascript(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .encaprtp(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .enriched(let suffix, let parameters):
hasher.combine(15)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(16)
hasher.combine(suffix)
hasher.combine(parameters)
case .fhirpath(let suffix, let parameters):
hasher.combine(17)
hasher.combine(suffix)
hasher.combine(parameters)
case .flexfec(let suffix, let parameters):
hasher.combine(18)
hasher.combine(suffix)
hasher.combine(parameters)
case .fwdred(let suffix, let parameters):
hasher.combine(19)
hasher.combine(suffix)
hasher.combine(parameters)
case .gff3(let suffix, let parameters):
hasher.combine(20)
hasher.combine(suffix)
hasher.combine(parameters)
case .grammarRefList(let suffix, let parameters):
hasher.combine(21)
hasher.combine(suffix)
hasher.combine(parameters)
case .html(let suffix, let parameters):
hasher.combine(22)
hasher.combine(suffix)
hasher.combine(parameters)
case .javascript(let suffix, let parameters):
hasher.combine(23)
hasher.combine(suffix)
hasher.combine(parameters)
case .jcrCnd(let suffix, let parameters):
hasher.combine(24)
hasher.combine(suffix)
hasher.combine(parameters)
case .markdown(let suffix, let parameters):
hasher.combine(25)
hasher.combine(suffix)
hasher.combine(parameters)
case .mizar(let suffix, let parameters):
hasher.combine(26)
hasher.combine(suffix)
hasher.combine(parameters)
case .n3(let suffix, let parameters):
hasher.combine(27)
hasher.combine(suffix)
hasher.combine(parameters)
case .parameters(let suffix, let parameters):
hasher.combine(28)
hasher.combine(suffix)
hasher.combine(parameters)
case .parityfec(let suffix, let parameters):
hasher.combine(29)
hasher.combine(suffix)
hasher.combine(parameters)
case .plain(let suffix, let parameters):
hasher.combine(30)
hasher.combine(suffix)
hasher.combine(parameters)
case .provenanceNotation(let suffix, let parameters):
hasher.combine(31)
hasher.combine(suffix)
hasher.combine(parameters)
case .raptorfec(let suffix, let parameters):
hasher.combine(32)
hasher.combine(suffix)
hasher.combine(parameters)
case .rfc822Headers(let suffix, let parameters):
hasher.combine(33)
hasher.combine(suffix)
hasher.combine(parameters)
case .richtext(let suffix, let parameters):
hasher.combine(34)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtf(let suffix, let parameters):
hasher.combine(35)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtpEncAescm128(let suffix, let parameters):
hasher.combine(36)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtploopback(let suffix, let parameters):
hasher.combine(37)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtx(let suffix, let parameters):
hasher.combine(38)
hasher.combine(suffix)
hasher.combine(parameters)
case .shaclc(let suffix, let parameters):
hasher.combine(39)
hasher.combine(suffix)
hasher.combine(parameters)
case .shex(let suffix, let parameters):
hasher.combine(40)
hasher.combine(suffix)
hasher.combine(parameters)
case .spdx(let suffix, let parameters):
hasher.combine(41)
hasher.combine(suffix)
hasher.combine(parameters)
case .strings(let suffix, let parameters):
hasher.combine(42)
hasher.combine(suffix)
hasher.combine(parameters)
case .t140(let suffix, let parameters):
hasher.combine(43)
hasher.combine(suffix)
hasher.combine(parameters)
case .tabSeparatedValues(let suffix, let parameters):
hasher.combine(44)
hasher.combine(suffix)
hasher.combine(parameters)
case .troff(let suffix, let parameters):
hasher.combine(45)
hasher.combine(suffix)
hasher.combine(parameters)
case .turtle(let suffix, let parameters):
hasher.combine(46)
hasher.combine(suffix)
hasher.combine(parameters)
case .ulpfec(let suffix, let parameters):
hasher.combine(47)
hasher.combine(suffix)
hasher.combine(parameters)
case .uriList(let suffix, let parameters):
hasher.combine(48)
hasher.combine(suffix)
hasher.combine(parameters)
case .vcard(let suffix, let parameters):
hasher.combine(49)
hasher.combine(suffix)
hasher.combine(parameters)
case .vtt(let suffix, let parameters):
hasher.combine(50)
hasher.combine(suffix)
hasher.combine(parameters)
case .xml(let suffix, let parameters):
hasher.combine(51)
hasher.combine(suffix)
hasher.combine(parameters)
case .xmlExternalParsedEntity(let suffix, let parameters):
hasher.combine(52)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,706 @@
import Foundation
/// Represents the `video` media type. See the
/// [official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#video) for details.
///
/// You typically use ``Video`` as a ``MediaType``.
///
/// ```swift
/// let video = Video.mp4()
/// let mediaType = MediaType.video(video) // Creates: video/mp4
/// ```
///
/// You can use standard `switch` statement to access video values.
///
/// ```swift
/// func isSupported(video: Video) -> Bool {
/// switch video {
/// case .mp4, .H264: return true
/// default: return false
/// }
/// }
///
/// isSupported(audio: .mp4()) // Returns: true
/// isSupported(audio: .H264()) // Returns: true
/// isSupported(audio: .vc1()) // Returns: false
/// ```
///
/// - SeeAlso: ``MediaType``
public enum Video {
/// Represents the `1d-interleaved-parityfec` subtype.
case _1dInterleavedParityfec(Suffix? = nil, Parameters? = nil)
/// Represents the `3gpp` subtype.
case _3gpp(Suffix? = nil, Parameters? = nil)
/// Represents the `3gpp2` subtype.
case _3gpp2(Suffix? = nil, Parameters? = nil)
/// Represents the `3gpp-tt` subtype.
case _3gppTt(Suffix? = nil, Parameters? = nil)
/// Represents the `AV1` subtype.
case AV1(Suffix? = nil, Parameters? = nil)
/// Represents the `BMPEG` subtype.
case BMPEG(Suffix? = nil, Parameters? = nil)
/// Represents the `BT656` subtype.
case BT656(Suffix? = nil, Parameters? = nil)
/// Represents the `CelB` subtype.
case CelB(Suffix? = nil, Parameters? = nil)
/// Represents the `DV` subtype.
case DV(Suffix? = nil, Parameters? = nil)
/// Represents the `encaprtp` subtype.
case encaprtp(Suffix? = nil, Parameters? = nil)
/// Represents the `example` subtype.
case example(Suffix? = nil, Parameters? = nil)
/// Represents the `FFV1` subtype.
case FFV1(Suffix? = nil, Parameters? = nil)
/// Represents the `flexfec` subtype.
case flexfec(Suffix? = nil, Parameters? = nil)
/// Represents the `H261` subtype.
case H261(Suffix? = nil, Parameters? = nil)
/// Represents the `H263` subtype.
case H263(Suffix? = nil, Parameters? = nil)
/// Represents the `H263-1998` subtype.
case H2631998(Suffix? = nil, Parameters? = nil)
/// Represents the `H263-2000` subtype.
case H2632000(Suffix? = nil, Parameters? = nil)
/// Represents the `H264` subtype.
case H264(Suffix? = nil, Parameters? = nil)
/// Represents the `H264-RCDO` subtype.
case H264RCDO(Suffix? = nil, Parameters? = nil)
/// Represents the `H264-SVC` subtype.
case H264SVC(Suffix? = nil, Parameters? = nil)
/// Represents the `H265` subtype.
case H265(Suffix? = nil, Parameters? = nil)
/// Represents the `JPEG` subtype.
case JPEG(Suffix? = nil, Parameters? = nil)
/// Represents the `jpeg2000` subtype.
case jpeg2000(Suffix? = nil, Parameters? = nil)
/// Represents the `jxsv` subtype.
case jxsv(Suffix? = nil, Parameters? = nil)
/// Represents the `mj2` subtype.
case mj2(Suffix? = nil, Parameters? = nil)
/// Represents the `MP1S` subtype.
case MP1S(Suffix? = nil, Parameters? = nil)
/// Represents the `MP2P` subtype.
case MP2P(Suffix? = nil, Parameters? = nil)
/// Represents the `MP2T` subtype.
case MP2T(Suffix? = nil, Parameters? = nil)
/// Represents the `mp4` subtype.
case mp4(Suffix? = nil, Parameters? = nil)
/// Represents the `MP4V-ES` subtype.
case MP4VES(Suffix? = nil, Parameters? = nil)
/// Represents the `MPV` subtype.
case MPV(Suffix? = nil, Parameters? = nil)
/// Represents the `mpeg` subtype.
case mpeg(Suffix? = nil, Parameters? = nil)
/// Represents the `mpeg4-generic` subtype.
case mpeg4Generic(Suffix? = nil, Parameters? = nil)
/// Represents the `nv` subtype.
case nv(Suffix? = nil, Parameters? = nil)
/// Represents the `ogg` subtype.
case ogg(Suffix? = nil, Parameters? = nil)
/// Represents the `parityfec` subtype.
case parityfec(Suffix? = nil, Parameters? = nil)
/// Represents the `pointer` subtype.
case pointer(Suffix? = nil, Parameters? = nil)
/// Represents the `quicktime` subtype.
case quicktime(Suffix? = nil, Parameters? = nil)
/// Represents the `raptorfec` subtype.
case raptorfec(Suffix? = nil, Parameters? = nil)
/// Represents the `raw` subtype.
case raw(Suffix? = nil, Parameters? = nil)
/// Represents the `rtp-enc-aescm128` subtype.
case rtpEncAescm128(Suffix? = nil, Parameters? = nil)
/// Represents the `rtploopback` subtype.
case rtploopback(Suffix? = nil, Parameters? = nil)
/// Represents the `rtx` subtype.
case rtx(Suffix? = nil, Parameters? = nil)
/// Represents the `scip` subtype.
case scip(Suffix? = nil, Parameters? = nil)
/// Represents the `smpte291` subtype.
case smpte291(Suffix? = nil, Parameters? = nil)
/// Represents the `SMPTE292M` subtype.
case SMPTE292M(Suffix? = nil, Parameters? = nil)
/// Represents the `ulpfec` subtype.
case ulpfec(Suffix? = nil, Parameters? = nil)
/// Represents the `vc1` subtype.
case vc1(Suffix? = nil, Parameters? = nil)
/// Represents the `vc2` subtype.
case vc2(Suffix? = nil, Parameters? = nil)
/// Represents the `VP8` subtype.
case VP8(Suffix? = nil, Parameters? = nil)
/// Represents the `VP9` subtype.
case VP9(Suffix? = nil, Parameters? = nil)
/// Represents a subtype that does not fit in the other cases or is currently not officially defined.
///
/// You can use this case to define an arbitrary, unregistered subtype with the given name or
/// to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.
///
/// Optionally, you can specify a ``Suffix`` and ``Parameters``.
///
case other(String, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Video: CustomStringConvertible {
public var description: String { rawValue }
}
extension Video: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "1d-interleaved-parityfec": self = ._1dInterleavedParityfec(suffix, parameters)
case "3gpp": self = ._3gpp(suffix, parameters)
case "3gpp2": self = ._3gpp2(suffix, parameters)
case "3gpp-tt": self = ._3gppTt(suffix, parameters)
case "AV1": self = .AV1(suffix, parameters)
case "BMPEG": self = .BMPEG(suffix, parameters)
case "BT656": self = .BT656(suffix, parameters)
case "CelB": self = .CelB(suffix, parameters)
case "DV": self = .DV(suffix, parameters)
case "encaprtp": self = .encaprtp(suffix, parameters)
case "example": self = .example(suffix, parameters)
case "FFV1": self = .FFV1(suffix, parameters)
case "flexfec": self = .flexfec(suffix, parameters)
case "H261": self = .H261(suffix, parameters)
case "H263": self = .H263(suffix, parameters)
case "H263-1998": self = .H2631998(suffix, parameters)
case "H263-2000": self = .H2632000(suffix, parameters)
case "H264": self = .H264(suffix, parameters)
case "H264-RCDO": self = .H264RCDO(suffix, parameters)
case "H264-SVC": self = .H264SVC(suffix, parameters)
case "H265": self = .H265(suffix, parameters)
case "JPEG": self = .JPEG(suffix, parameters)
case "jpeg2000": self = .jpeg2000(suffix, parameters)
case "jxsv": self = .jxsv(suffix, parameters)
case "mj2": self = .mj2(suffix, parameters)
case "MP1S": self = .MP1S(suffix, parameters)
case "MP2P": self = .MP2P(suffix, parameters)
case "MP2T": self = .MP2T(suffix, parameters)
case "mp4": self = .mp4(suffix, parameters)
case "MP4V-ES": self = .MP4VES(suffix, parameters)
case "MPV": self = .MPV(suffix, parameters)
case "mpeg": self = .mpeg(suffix, parameters)
case "mpeg4-generic": self = .mpeg4Generic(suffix, parameters)
case "nv": self = .nv(suffix, parameters)
case "ogg": self = .ogg(suffix, parameters)
case "parityfec": self = .parityfec(suffix, parameters)
case "pointer": self = .pointer(suffix, parameters)
case "quicktime": self = .quicktime(suffix, parameters)
case "raptorfec": self = .raptorfec(suffix, parameters)
case "raw": self = .raw(suffix, parameters)
case "rtp-enc-aescm128": self = .rtpEncAescm128(suffix, parameters)
case "rtploopback": self = .rtploopback(suffix, parameters)
case "rtx": self = .rtx(suffix, parameters)
case "scip": self = .scip(suffix, parameters)
case "smpte291": self = .smpte291(suffix, parameters)
case "SMPTE292M": self = .SMPTE292M(suffix, parameters)
case "ulpfec": self = .ulpfec(suffix, parameters)
case "vc1": self = .vc1(suffix, parameters)
case "vc2": self = .vc2(suffix, parameters)
case "VP8": self = .VP8(suffix, parameters)
case "VP9": self = .VP9(suffix, parameters)
case "*": self = .anything(suffix, parameters)
default: self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case ._1dInterleavedParityfec(let suffix, let parameters): return "1d-interleaved-parityfec\(suffix)\(parameters)"
case ._3gpp(let suffix, let parameters): return "3gpp\(suffix)\(parameters)"
case ._3gpp2(let suffix, let parameters): return "3gpp2\(suffix)\(parameters)"
case ._3gppTt(let suffix, let parameters): return "3gpp-tt\(suffix)\(parameters)"
case .AV1(let suffix, let parameters): return "AV1\(suffix)\(parameters)"
case .BMPEG(let suffix, let parameters): return "BMPEG\(suffix)\(parameters)"
case .BT656(let suffix, let parameters): return "BT656\(suffix)\(parameters)"
case .CelB(let suffix, let parameters): return "CelB\(suffix)\(parameters)"
case .DV(let suffix, let parameters): return "DV\(suffix)\(parameters)"
case .encaprtp(let suffix, let parameters): return "encaprtp\(suffix)\(parameters)"
case .example(let suffix, let parameters): return "example\(suffix)\(parameters)"
case .FFV1(let suffix, let parameters): return "FFV1\(suffix)\(parameters)"
case .flexfec(let suffix, let parameters): return "flexfec\(suffix)\(parameters)"
case .H261(let suffix, let parameters): return "H261\(suffix)\(parameters)"
case .H263(let suffix, let parameters): return "H263\(suffix)\(parameters)"
case .H2631998(let suffix, let parameters): return "H263-1998\(suffix)\(parameters)"
case .H2632000(let suffix, let parameters): return "H263-2000\(suffix)\(parameters)"
case .H264(let suffix, let parameters): return "H264\(suffix)\(parameters)"
case .H264RCDO(let suffix, let parameters): return "H264-RCDO\(suffix)\(parameters)"
case .H264SVC(let suffix, let parameters): return "H264-SVC\(suffix)\(parameters)"
case .H265(let suffix, let parameters): return "H265\(suffix)\(parameters)"
case .JPEG(let suffix, let parameters): return "JPEG\(suffix)\(parameters)"
case .jpeg2000(let suffix, let parameters): return "jpeg2000\(suffix)\(parameters)"
case .jxsv(let suffix, let parameters): return "jxsv\(suffix)\(parameters)"
case .mj2(let suffix, let parameters): return "mj2\(suffix)\(parameters)"
case .MP1S(let suffix, let parameters): return "MP1S\(suffix)\(parameters)"
case .MP2P(let suffix, let parameters): return "MP2P\(suffix)\(parameters)"
case .MP2T(let suffix, let parameters): return "MP2T\(suffix)\(parameters)"
case .mp4(let suffix, let parameters): return "mp4\(suffix)\(parameters)"
case .MP4VES(let suffix, let parameters): return "MP4V-ES\(suffix)\(parameters)"
case .MPV(let suffix, let parameters): return "MPV\(suffix)\(parameters)"
case .mpeg(let suffix, let parameters): return "mpeg\(suffix)\(parameters)"
case .mpeg4Generic(let suffix, let parameters): return "mpeg4-generic\(suffix)\(parameters)"
case .nv(let suffix, let parameters): return "nv\(suffix)\(parameters)"
case .ogg(let suffix, let parameters): return "ogg\(suffix)\(parameters)"
case .parityfec(let suffix, let parameters): return "parityfec\(suffix)\(parameters)"
case .pointer(let suffix, let parameters): return "pointer\(suffix)\(parameters)"
case .quicktime(let suffix, let parameters): return "quicktime\(suffix)\(parameters)"
case .raptorfec(let suffix, let parameters): return "raptorfec\(suffix)\(parameters)"
case .raw(let suffix, let parameters): return "raw\(suffix)\(parameters)"
case .rtpEncAescm128(let suffix, let parameters): return "rtp-enc-aescm128\(suffix)\(parameters)"
case .rtploopback(let suffix, let parameters): return "rtploopback\(suffix)\(parameters)"
case .rtx(let suffix, let parameters): return "rtx\(suffix)\(parameters)"
case .scip(let suffix, let parameters): return "scip\(suffix)\(parameters)"
case .smpte291(let suffix, let parameters): return "smpte291\(suffix)\(parameters)"
case .SMPTE292M(let suffix, let parameters): return "SMPTE292M\(suffix)\(parameters)"
case .ulpfec(let suffix, let parameters): return "ulpfec\(suffix)\(parameters)"
case .vc1(let suffix, let parameters): return "vc1\(suffix)\(parameters)"
case .vc2(let suffix, let parameters): return "vc2\(suffix)\(parameters)"
case .VP8(let suffix, let parameters): return "VP8\(suffix)\(parameters)"
case .VP9(let suffix, let parameters): return "VP9\(suffix)\(parameters)"
case .other(let value, let suffix, let parameters): return "\(value)\(suffix)\(parameters)"
case .anything(let suffix, let parameters): return "*\(suffix)\(parameters)"
}
}
}
extension Video: MediaSubtype { public var type: MediaType { .video(self) } }
extension Video: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .AV1(let lhsSuffix, let lhsParameters):
guard case let .AV1(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .BMPEG(let lhsSuffix, let lhsParameters):
guard case let .BMPEG(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .BT656(let lhsSuffix, let lhsParameters):
guard case let .BT656(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .CelB(let lhsSuffix, let lhsParameters):
guard case let .CelB(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .DV(let lhsSuffix, let lhsParameters):
guard case let .DV(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .FFV1(let lhsSuffix, let lhsParameters):
guard case let .FFV1(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H261(let lhsSuffix, let lhsParameters):
guard case let .H261(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H263(let lhsSuffix, let lhsParameters):
guard case let .H263(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H2631998(let lhsSuffix, let lhsParameters):
guard case let .H2631998(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H2632000(let lhsSuffix, let lhsParameters):
guard case let .H2632000(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H264(let lhsSuffix, let lhsParameters):
guard case let .H264(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H264RCDO(let lhsSuffix, let lhsParameters):
guard case let .H264RCDO(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H264SVC(let lhsSuffix, let lhsParameters):
guard case let .H264SVC(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .H265(let lhsSuffix, let lhsParameters):
guard case let .H265(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .JPEG(let lhsSuffix, let lhsParameters):
guard case let .JPEG(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .MP1S(let lhsSuffix, let lhsParameters):
guard case let .MP1S(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .MP2P(let lhsSuffix, let lhsParameters):
guard case let .MP2P(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .MP2T(let lhsSuffix, let lhsParameters):
guard case let .MP2T(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .MP4VES(let lhsSuffix, let lhsParameters):
guard case let .MP4VES(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .MPV(let lhsSuffix, let lhsParameters):
guard case let .MPV(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .SMPTE292M(let lhsSuffix, let lhsParameters):
guard case let .SMPTE292M(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .VP8(let lhsSuffix, let lhsParameters):
guard case let .VP8(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .VP9(let lhsSuffix, let lhsParameters):
guard case let .VP9(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case ._1dInterleavedParityfec(let lhsSuffix, let lhsParameters):
guard case let ._1dInterleavedParityfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case ._3gpp(let lhsSuffix, let lhsParameters):
guard case let ._3gpp(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case ._3gpp2(let lhsSuffix, let lhsParameters):
guard case let ._3gpp2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case ._3gppTt(let lhsSuffix, let lhsParameters):
guard case let ._3gppTt(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .encaprtp(let lhsSuffix, let lhsParameters):
guard case let .encaprtp(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .example(let lhsSuffix, let lhsParameters):
guard case let .example(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .flexfec(let lhsSuffix, let lhsParameters):
guard case let .flexfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jpeg2000(let lhsSuffix, let lhsParameters):
guard case let .jpeg2000(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .jxsv(let lhsSuffix, let lhsParameters):
guard case let .jxsv(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mj2(let lhsSuffix, let lhsParameters):
guard case let .mj2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mp4(let lhsSuffix, let lhsParameters):
guard case let .mp4(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mpeg(let lhsSuffix, let lhsParameters):
guard case let .mpeg(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .mpeg4Generic(let lhsSuffix, let lhsParameters):
guard case let .mpeg4Generic(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .nv(let lhsSuffix, let lhsParameters):
guard case let .nv(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ogg(let lhsSuffix, let lhsParameters):
guard case let .ogg(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .parityfec(let lhsSuffix, let lhsParameters):
guard case let .parityfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .pointer(let lhsSuffix, let lhsParameters):
guard case let .pointer(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .quicktime(let lhsSuffix, let lhsParameters):
guard case let .quicktime(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .raptorfec(let lhsSuffix, let lhsParameters):
guard case let .raptorfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .raw(let lhsSuffix, let lhsParameters):
guard case let .raw(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtpEncAescm128(let lhsSuffix, let lhsParameters):
guard case let .rtpEncAescm128(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtploopback(let lhsSuffix, let lhsParameters):
guard case let .rtploopback(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .rtx(let lhsSuffix, let lhsParameters):
guard case let .rtx(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .scip(let lhsSuffix, let lhsParameters):
guard case let .scip(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .smpte291(let lhsSuffix, let lhsParameters):
guard case let .smpte291(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .ulpfec(let lhsSuffix, let lhsParameters):
guard case let .ulpfec(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .vc1(let lhsSuffix, let lhsParameters):
guard case let .vc1(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .vc2(let lhsSuffix, let lhsParameters):
guard case let .vc2(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .AV1(let suffix, let parameters):
hasher.combine(0)
hasher.combine(suffix)
hasher.combine(parameters)
case .BMPEG(let suffix, let parameters):
hasher.combine(1)
hasher.combine(suffix)
hasher.combine(parameters)
case .BT656(let suffix, let parameters):
hasher.combine(2)
hasher.combine(suffix)
hasher.combine(parameters)
case .CelB(let suffix, let parameters):
hasher.combine(3)
hasher.combine(suffix)
hasher.combine(parameters)
case .DV(let suffix, let parameters):
hasher.combine(4)
hasher.combine(suffix)
hasher.combine(parameters)
case .FFV1(let suffix, let parameters):
hasher.combine(5)
hasher.combine(suffix)
hasher.combine(parameters)
case .H261(let suffix, let parameters):
hasher.combine(6)
hasher.combine(suffix)
hasher.combine(parameters)
case .H263(let suffix, let parameters):
hasher.combine(7)
hasher.combine(suffix)
hasher.combine(parameters)
case .H2631998(let suffix, let parameters):
hasher.combine(8)
hasher.combine(suffix)
hasher.combine(parameters)
case .H2632000(let suffix, let parameters):
hasher.combine(9)
hasher.combine(suffix)
hasher.combine(parameters)
case .H264(let suffix, let parameters):
hasher.combine(10)
hasher.combine(suffix)
hasher.combine(parameters)
case .H264RCDO(let suffix, let parameters):
hasher.combine(11)
hasher.combine(suffix)
hasher.combine(parameters)
case .H264SVC(let suffix, let parameters):
hasher.combine(12)
hasher.combine(suffix)
hasher.combine(parameters)
case .H265(let suffix, let parameters):
hasher.combine(13)
hasher.combine(suffix)
hasher.combine(parameters)
case .JPEG(let suffix, let parameters):
hasher.combine(14)
hasher.combine(suffix)
hasher.combine(parameters)
case .MP1S(let suffix, let parameters):
hasher.combine(15)
hasher.combine(suffix)
hasher.combine(parameters)
case .MP2P(let suffix, let parameters):
hasher.combine(16)
hasher.combine(suffix)
hasher.combine(parameters)
case .MP2T(let suffix, let parameters):
hasher.combine(17)
hasher.combine(suffix)
hasher.combine(parameters)
case .MP4VES(let suffix, let parameters):
hasher.combine(18)
hasher.combine(suffix)
hasher.combine(parameters)
case .MPV(let suffix, let parameters):
hasher.combine(19)
hasher.combine(suffix)
hasher.combine(parameters)
case .SMPTE292M(let suffix, let parameters):
hasher.combine(20)
hasher.combine(suffix)
hasher.combine(parameters)
case .VP8(let suffix, let parameters):
hasher.combine(21)
hasher.combine(suffix)
hasher.combine(parameters)
case .VP9(let suffix, let parameters):
hasher.combine(22)
hasher.combine(suffix)
hasher.combine(parameters)
case ._1dInterleavedParityfec(let suffix, let parameters):
hasher.combine(23)
hasher.combine(suffix)
hasher.combine(parameters)
case ._3gpp(let suffix, let parameters):
hasher.combine(24)
hasher.combine(suffix)
hasher.combine(parameters)
case ._3gpp2(let suffix, let parameters):
hasher.combine(25)
hasher.combine(suffix)
hasher.combine(parameters)
case ._3gppTt(let suffix, let parameters):
hasher.combine(26)
hasher.combine(suffix)
hasher.combine(parameters)
case .encaprtp(let suffix, let parameters):
hasher.combine(27)
hasher.combine(suffix)
hasher.combine(parameters)
case .example(let suffix, let parameters):
hasher.combine(28)
hasher.combine(suffix)
hasher.combine(parameters)
case .flexfec(let suffix, let parameters):
hasher.combine(29)
hasher.combine(suffix)
hasher.combine(parameters)
case .jpeg2000(let suffix, let parameters):
hasher.combine(30)
hasher.combine(suffix)
hasher.combine(parameters)
case .jxsv(let suffix, let parameters):
hasher.combine(31)
hasher.combine(suffix)
hasher.combine(parameters)
case .mj2(let suffix, let parameters):
hasher.combine(32)
hasher.combine(suffix)
hasher.combine(parameters)
case .mp4(let suffix, let parameters):
hasher.combine(33)
hasher.combine(suffix)
hasher.combine(parameters)
case .mpeg(let suffix, let parameters):
hasher.combine(34)
hasher.combine(suffix)
hasher.combine(parameters)
case .mpeg4Generic(let suffix, let parameters):
hasher.combine(35)
hasher.combine(suffix)
hasher.combine(parameters)
case .nv(let suffix, let parameters):
hasher.combine(36)
hasher.combine(suffix)
hasher.combine(parameters)
case .ogg(let suffix, let parameters):
hasher.combine(37)
hasher.combine(suffix)
hasher.combine(parameters)
case .parityfec(let suffix, let parameters):
hasher.combine(38)
hasher.combine(suffix)
hasher.combine(parameters)
case .pointer(let suffix, let parameters):
hasher.combine(39)
hasher.combine(suffix)
hasher.combine(parameters)
case .quicktime(let suffix, let parameters):
hasher.combine(40)
hasher.combine(suffix)
hasher.combine(parameters)
case .raptorfec(let suffix, let parameters):
hasher.combine(41)
hasher.combine(suffix)
hasher.combine(parameters)
case .raw(let suffix, let parameters):
hasher.combine(42)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtpEncAescm128(let suffix, let parameters):
hasher.combine(43)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtploopback(let suffix, let parameters):
hasher.combine(44)
hasher.combine(suffix)
hasher.combine(parameters)
case .rtx(let suffix, let parameters):
hasher.combine(45)
hasher.combine(suffix)
hasher.combine(parameters)
case .scip(let suffix, let parameters):
hasher.combine(46)
hasher.combine(suffix)
hasher.combine(parameters)
case .smpte291(let suffix, let parameters):
hasher.combine(47)
hasher.combine(suffix)
hasher.combine(parameters)
case .ulpfec(let suffix, let parameters):
hasher.combine(48)
hasher.combine(suffix)
hasher.combine(parameters)
case .vc1(let suffix, let parameters):
hasher.combine(49)
hasher.combine(suffix)
hasher.combine(parameters)
case .vc2(let suffix, let parameters):
hasher.combine(50)
hasher.combine(suffix)
hasher.combine(parameters)
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}

View File

@ -0,0 +1,72 @@
import Foundation
internal typealias RawSubtype = (
subtype: String,
suffix: Suffix?,
parameters: Parameters?
)
internal func convert(string rawValue: String) -> RawSubtype {
let chunks = rawValue.split(separator: ";")
let parameterChunks = chunks.count > 1 ? chunks[1...] : []
let parameters: Parameters? = parameterChunks.isEmpty
? nil
: parameterChunks
.map { $0.split(separator: "=") }
.reduce(into: [:]) { (result, parameterChunk) in
if parameterChunk.isEmpty { return }
result?[String(parameterChunk.first!).trimmingCharacters(in: .whitespacesAndNewlines)] = parameterChunk.indices.contains(1)
? parameterChunk[1].trimmingCharacters(in: .whitespacesAndNewlines)
: nil
}
let suffixedChunks = chunks.first?.split(separator: "+")
let subType = suffixedChunks?.first ?? "*"
let suffix = (suffixedChunks?.count ?? 0) > 1
? suffixedChunks?[1] == nil
? nil
: Suffix(rawValue: String(suffixedChunks![1]))
: nil
return (
subtype: String(subType),
suffix: suffix,
parameters: parameters
)
}
func ==(lhs: Parameters, rhs: Parameters) -> Bool {
if lhs.keys != rhs.keys { return false }
for (lhsKey, lhsValue) in lhs {
guard let rhsValue = rhs[lhsKey] else {
if lhsValue != nil {
return false
} else {
continue
}
}
guard let lhsValue = lhsValue else { return false }
if lhsValue.description != rhsValue!.description { return false }
}
return true
}
func !=(lhs: Parameters, rhs: Parameters) -> Bool { !(lhs == rhs) }
func ==(lhs: Parameters?, rhs: Parameters?) -> Bool {
var leftIsNil = false
var rightIsNil = false
if case .none = lhs { leftIsNil = true }
if case .none = rhs { rightIsNil = true }
if leftIsNil || rightIsNil { return leftIsNil == rightIsNil }
return lhs! == rhs!
}
func !=(lhs: Parameters?, rhs: Parameters?) -> Bool { !(lhs == rhs) }
extension Hasher {
@inlinable mutating func combine(_ value: Parameters?) {
guard let value = value else { return }
for (key, value) in value {
combine(key)
combine(value?.description)
}
}
}

6
TODO.md Normal file
View File

@ -0,0 +1,6 @@
# Further Things To Do
- [x] Generate Subtype enums
- [ ] Add support for media suffix
- [ ] Add support for media parameters
- [ ] Add support for tree subtypes

View File

@ -0,0 +1,25 @@
import XCTest
import MediaType
extension CodeExamples {
func test_application() {
let application = Application.atom(.xml, ["charset": "utf-8"])
let mediaType = MediaType.application(application)
XCTAssertEqual(mediaType, .application(.atom(.xml, ["charset": "utf-8"])))
}
func test_isSupportedApplication() {
func isSupported(application: Application) -> Bool {
switch application {
case .senml(.cbor, _), .senml(.json, _), .senml(.xml, _): return true
default: return false
}
}
XCTAssertTrue(isSupported(application: .senml(.cbor)))
XCTAssertTrue(isSupported(application: .senml(.json)))
XCTAssertTrue(isSupported(application: .senml(.xml)))
XCTAssertFalse(isSupported(application: .senml(.zip)))
XCTAssertFalse(isSupported(application: .json()))
}
}

View File

@ -0,0 +1,24 @@
import XCTest
import MediaType
extension CodeExamples {
func test_font() {
let font = Font.ttf(nil, ["layout": "oat,aat"])
let mediaType = MediaType.font(font)
XCTAssertEqual(mediaType, "font/ttf;layout=oat,aat")
}
func test_isSupportedFont() {
func isSupported(font: Font) -> Bool {
switch font {
case .woff, .woff2: return true
case .ttf(_, let parameters?): return !parameters.isEmpty
default: return false
}
}
XCTAssertTrue(isSupported(font: .woff()))
XCTAssertTrue(isSupported(font: .ttf(nil, ["layout": "oat,aat"])))
XCTAssertFalse(isSupported(font: .ttf()))
}
}

View File

@ -0,0 +1,19 @@
import XCTest
import MediaType
extension CodeExamples {
func test_description() {
XCTAssertEqual(
MediaType.text(.css()).description,
"text/css"
)
XCTAssertEqual(
MediaType.audio(.ac3(nil, ["rate": 32000])).description,
"audio/ac3;rate=32000"
)
XCTAssertEqual(
MediaType.application(.atom(.xml, ["charset": "utf-8"])).description,
"application/atom+xml;charset=utf-8"
)
}
}

View File

@ -0,0 +1,88 @@
import XCTest
import MediaType
extension CodeExamples {
func test_create_media_type_using_initializer() {
XCTAssertEqual(MediaType.application(.json()), "application/json")
}
func test_create_media_type_with_string_literal() {
XCTAssertEqual("application/json", MediaType.application(.json()))
}
func test_media_type_from_string_variable() {
let rawMediaType = "application/json"
XCTAssertEqual(MediaType(rawValue: rawMediaType), MediaType.application(.json()))
}
func test_audio_media_type() {
XCTAssertEqual((MediaType.audio(.ac3())), "audio/ac3")
XCTAssertEqual((MediaType.audio(.mpeg())), "audio/mpeg")
}
func test_application_json_with_json_suffix() {
XCTAssertEqual("application/json+json", MediaType.application(.json(.json)))
}
func test_image_with_other_subtype() {
XCTAssertEqual("image/json", MediaType.image(.other("json")))
}
func test_wildcard_media_type() {
XCTAssertEqual("*/*", MediaType.anything(.anything()))
XCTAssertEqual("*/dialog", MediaType.anything(.other("dialog")))
XCTAssertEqual("*/response+xml", MediaType.anything(.other("response", .xml)))
}
func test_media_type_with_parameters() {
XCTAssertEqual("audio/ac3;rate=32000", MediaType.audio(.ac3(nil, ["rate": 32000])))
XCTAssertEqual("application/atom; charset=utf-8", MediaType.application(.atom(nil, ["charset": "utf-8"])))
}
func test_media_type_with_suffix() {
XCTAssertEqual("application/atom+xml", MediaType.application(.atom(.xml)))
}
func test_media_type_with_suffix_and_parameters() {
XCTAssertEqual("application/atom+xml; charset=utf-8", MediaType.application(.atom(.xml, ["charset": "utf-8"])))
}
func test_vendor_tree() {
XCTAssertEqual("application/vnd.efi.img", MediaType.application(.other("vnd.efi.img")))
}
func test_unregistered_media_types() {
XCTAssertEqual(MediaType.image(.svg(.gzip)), "image/svg+gzip")
XCTAssertEqual(MediaType.application(.other("myApp", .json)), "application/myApp+json")
}
func test_matching() {
func isSupported(_ mediaType: MediaType) -> Bool {
switch mediaType {
case .application(.json(_, _)): return true
case .application(.atom("xml", _)): return true
case .application(let subtype):
switch subtype {
case .xml(_, _): return true
default: return false
}
default: return false
}
}
XCTAssertTrue(isSupported("application/json"))
XCTAssertTrue(isSupported("application/json+xml"))
XCTAssertTrue(isSupported("application/json;charset=utf-8"))
XCTAssertTrue(isSupported("application/json+xml;charset=utf-8"))
XCTAssertTrue(isSupported("application/atom+xml"))
XCTAssertTrue(isSupported("application/atom+xml;charset=utf-8"))
XCTAssertFalse(isSupported("application/atom"))
XCTAssertFalse(isSupported("application/atom;charset=utf-8"))
}
func test_supported_media_types() {
let supportedImages: Set<MediaType> = ["image/png", "image/gif", "image/jpeg"]
XCTAssertEqual(supportedImages, [.image(.png()), .image(.jpeg()), .image(.gif())])
}
}

View File

@ -0,0 +1,15 @@
import XCTest
import MediaType
extension CodeExamples {
func test_parameters_use_cases() {
let mediaType_A = MediaType.audio(.ac3(nil, ["rate": 32_000]))
let mediaType_B: MediaType = "audio/ac3;rate=32000"
let rawMediaType = "audio/ac3;rate=32000"
let mediaType_C = MediaType(rawValue: rawMediaType)
XCTAssertEqual(mediaType_A, mediaType_B)
XCTAssertEqual(mediaType_A, mediaType_C)
XCTAssertEqual(mediaType_B, mediaType_C)
}
}

View File

@ -0,0 +1,21 @@
import XCTest
import MediaType
extension CodeExamples {
func test_suffix_use_cases() {
XCTAssertEqual(MediaType.application(.jose(.json)), "application/jose+json")
XCTAssertEqual(MediaType.application(.jose(.other("custom"))), "application/jose+custom")
XCTAssertEqual(MediaType.image(.svg("zip")), "image/svg+zip")
}
func test_getting_suffix() {
let mediaType = MediaType.application(.calendar(.xml))
switch mediaType {
case .application(.calendar(let suffix, _)):
guard let suffix = suffix else { break }
XCTAssertEqual("Suffix: \(suffix)", "Suffix: +xml")
default:
XCTFail("Unsupported media type: \(mediaType)")
}
}
}

View File

@ -0,0 +1,3 @@
import XCTest
class CodeExamples: XCTestCase {}

View File

@ -0,0 +1,15 @@
import Foundation
import MediaType
import XCTest
class MediaTypeTest: XCTestCase {
func baba(_ type: MediaType) {
print("Received: \(type)")
dump(type)
}
func testYolo() {
baba("application/json; charset=utf-8")
}
}

View File

@ -1,177 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Type Aliases Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
<a title="Type Aliases Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Type Aliases Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType10Parametersa"></a>
<a name="//apple_ref/swift/Alias/Parameters" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType10Parametersa">Parameters</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents parameters of <code><a href="Enums/MediaType.html">MediaType</a></code>s.</p>
<p>A media type may have parameters. For example <code>text/html;charset=utf-8</code> defines a media type with UTF-8 charset
instead of the default ASCII.</p>
<p>You can specify arbitrary parameters to <em>any</em> of the <code><a href="Enums/MediaType.html">MediaType</a></code>s using a Swift
<a href="https://developer.apple.com/documentation/swift/dictionary">dictionary</a>. Keep in mind though, that not all such
parameter values are registered (see the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>You can specify parameters by using either the Swift DSL or string literal syntax. Parameters in string variables
are also supported. The following examples are equivalent:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"audio/ac3;rate=32000"</span> <span class="c1">// is equivalent to</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32_000</span><span class="p">]))</span> <span class="c1">// is equivalent to</span>
<span class="k">let</span> <span class="nv">rawMediaType</span> <span class="o">=</span> <span class="s">"audio/ac3;rate=32000"</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">rawMediaType</span><span class="p">)</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Parameters</span> <span class="o">=</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">?]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,402 @@
/**
* @param {[string]} lines
* @param {number} indentation
* @returns {string}
*/
export function toDocumentation(lines, indentation) {
return lines
.map(line => `/// ${line}`)
.map(line => line.padStart(line.length + indentation, ' '))
.join('\n')
}
export const mediaDocumentations = {
generic: {
typeDoc: {
otherCase: [
"Represents a subtype that does not fit in the other cases or is currently not officially defined.",
"",
"You can use this case to define an arbitrary, unregistered subtype with the given name or",
"to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.",
"",
"Optionally, you can specify a ``Suffix`` and ``Parameters``."
]
}
},
application: {
typeDoc: {
description: [
"Represents the `application` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#application) for details.",
"",
"You typically use ``Application`` as a ``MediaType``.",
"",
"```swift",
'let application = Application.atom(.xml, ["charset": "utf-8"])',
"let mediaType = MediaType.application(application) // Creates: application/atom+xml;charset=utf-8",
"```",
"",
"You can use standard `switch` statement to access application values.",
"",
"```swift",
"func isSupported(application: Application) -> Bool {",
" switch application {",
" case .senml(.cbor, _), .senml(.json, _), .senml(.xml, _): return true",
" default: return false",
" }",
"}",
"",
"isSupported(application: .senml(.cbor)) // Returns: true",
"isSupported(application: .senml(.json)) // Returns: true",
"isSupported(application: .senml(.xml)) // Returns: true",
"isSupported(application: .senml(.zip)) // Returns: false",
"isSupported(application: .json()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `application` media type.",
"",
"Represents binary data. Common examples: `application/json`, `application/octet-stream`.",
"",
"For the whole family of `application` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#application) documentation."
]
},
audio: {
typeDoc: {
description: [
"Represents the `audio` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#audio) for details.",
"",
"You typically use ``Audio`` as a ``MediaType``.",
"",
"```swift",
'let audio = Audio.ac3(nil, ["rate": 32000])',
"let mediaType = MediaType.audio(audio) // Creates: audio/ac3;rate=32000",
"```",
"",
"You can use standard `switch` statement to access audio values.",
"",
"```swift",
"func isSupported(audio: Audio) -> Bool {",
" switch audio {",
" case .ac3, .aac, .ogg: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .ac3()) // Returns: true",
"isSupported(audio: .aac()) // Returns: true",
"isSupported(audio: .ogg()) // Returns: true",
"isSupported(audio: .mpeg()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `audio` media type.",
"",
"Represents audible data. Common examples: `audio/ac3`, `audio/mpeg`.",
"",
"For the whole family of `audio` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#audio) documentation."
]
},
font: {
typeDoc: {
description: [
"Represents the `font` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#font) for details.",
"",
"You typically use ``Font`` as a ``MediaType``.",
"",
"```swift",
'let font = Font.ttf(nil, ["layout": "oat,aat"])',
"let mediaType = MediaType.font(font) // Creates: font/ttf;layout=oat,aat",
"```",
"",
"You can use standard `switch` statement to access font values.",
"",
"```swift",
"func isSupported(font: Font) -> Bool {",
" switch font {",
" case .woff, .woff2: return true",
" case .ttf(_, let parameters?): return !parameters.isEmpty",
" default: return false",
" }",
"}",
"",
"isSupported(font: .woff()) // Returns: true",
'isSupported(font: .ttf(nil, ["layout": "oat,aat"])) // Returns: true',
"isSupported(font: .ttf()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `font` media type.",
"",
"Represents font or typeface data. Common examples: `font/woff`, `font/ttf`.",
"",
"For the whole family of `font` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#font) documentation."
]
},
image: {
typeDoc: {
description: [
"Represents the `image` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#image) for details.",
"",
"You typically use ``Image`` as a ``MediaType``.",
"",
"```swift",
'let image = Image.png()',
"let mediaType = MediaType.image(image) // Creates: image/png",
"```",
"",
"You can use standard `switch` statement to access image values.",
"",
"```swift",
"func isSupported(image: Image) -> Bool {",
" switch image {",
" case .png, .jpeg, .gif: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .png()) // Returns: true",
"isSupported(audio: .jpeg()) // Returns: true",
"isSupported(audio: .gif()) // Returns: true",
"isSupported(audio: .bmp()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `image` media type.",
"",
"Represents image or graphical data. This includes bitmap and vector images, along with animated image formats.",
"Common examples: `image/jpeg`, `image/apng`.",
"",
"For the whole family of `image` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#image) documentation."
]
},
message: {
typeDoc: {
description: [
"Represents the `message` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#message) for details.",
"",
"You typically use ``Message`` as a ``MediaType``.",
"",
"```swift",
'let message = Message.http()',
"let mediaType = MediaType.message(message) // Creates: message/http",
"```",
"",
"You can use standard `switch` statement to access message values.",
"",
"```swift",
"func isSupported(message: Message) -> Bool {",
" switch message {",
" case .http, .rfc822: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .http()) // Returns: true",
"isSupported(audio: .rfc822()) // Returns: true",
"isSupported(audio: .sip()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `message` media type.",
"",
"Represents embedded message data. Common examples: `message/rfc882`, `message/http`.",
"",
"For the whole family of `message` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#message) documentation."
]
},
model: {
typeDoc: {
description: [
"Represents the `model` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#model) for details.",
"",
"You typically use ``Model`` as a ``MediaType``.",
"",
"```swift",
'let model = Model.step()',
"let mediaType = MediaType.model(model) // Creates: model/step",
"```",
"",
"You can use standard `switch` statement to access model values.",
"",
"```swift",
"func isSupported(model: Model) -> Bool {",
" switch model {",
" case .step, .iges: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .step()) // Returns: true",
"isSupported(audio: .iges()) // Returns: true",
"isSupported(audio: .mesh()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `model` media type.",
"",
"Represents 3D modelling data. Common examples: `model/step`, `model/3mf`.",
"",
"For the whole family of `model` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#model) documentation."
]
},
multipart: {
typeDoc: {
description: [
"Represents the `multipart` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#multipart) for details.",
"",
"You typically use ``Multipart`` as a ``MediaType``.",
"",
"```swift",
'let multipart = Multipart.formData()',
"let mediaType = MediaType.multipart(multipart) // Creates: multipart/form-data",
"```",
"",
"You can use standard `switch` statement to access multipart values.",
"",
"```swift",
"func isSupported(multipart: Multipart) -> Bool {",
" switch multipart {",
" case .formData, .mixed: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .formData()) // Returns: true",
"isSupported(audio: .mixed()) // Returns: true",
"isSupported(audio: .voiceMessage()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `multipart` media type.",
"",
"Represents data formed from multiple components, which may have their individual media types.",
"Common examples: `multipart/form-data`, `multipart/encrypted`.",
"",
"For the whole family of `multipart` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#multipart) documentation."
]
},
text: {
typeDoc: {
description: [
"Represents the `text` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#text) for details.",
"",
"You typically use ``Text`` as a ``MediaType``.",
"",
"```swift",
'let text = Text.html()',
"let mediaType = MediaType.text(text) // Creates: text/html",
"```",
"",
"You can use standard `switch` statement to access text values.",
"",
"```swift",
"func isSupported(text: Text) -> Bool {",
" switch text {",
" case .html, .css: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .html()) // Returns: true",
"isSupported(audio: .css()) // Returns: true",
"isSupported(audio: .javascript()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `text` media type.",
"",
"Represents textual only data. Common examples: `text/css`, `text/html`.",
"",
"For the whole family of `text` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#text) documentation."
]
},
video: {
typeDoc: {
description: [
"Represents the `video` media type. See the",
"[official documentation](https://www.iana.org/assignments/media-types/media-types.xhtml#video) for details.",
"",
"You typically use ``Video`` as a ``MediaType``.",
"",
"```swift",
'let video = Video.mp4()',
"let mediaType = MediaType.video(video) // Creates: video/mp4",
"```",
"",
"You can use standard `switch` statement to access video values.",
"",
"```swift",
"func isSupported(video: Video) -> Bool {",
" switch video {",
" case .mp4, .H264: return true",
" default: return false",
" }",
"}",
"",
"isSupported(audio: .mp4()) // Returns: true",
"isSupported(audio: .H264()) // Returns: true",
"isSupported(audio: .vc1()) // Returns: false",
"```",
"",
"- SeeAlso: ``MediaType``",
],
otherCase: []
},
caseDoc: [
"Represents the `video` media type.",
"",
"Represents video data. Common examples: `video/mp4`, `video/H264`.",
"",
"For the whole family of `video` media types consult the",
"[official IANA](https://www.iana.org/assignments/media-types/media-types.xhtml#video) documentation."
]
}
}

1964
UtilityScripts/Medias.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,49 @@
// Run this script in the browser on https://www.iana.org/assignments/media-types/media-types.xhtml#application
const validTypes = [
"application",
"audio",
"font",
"image",
"message",
"model",
"multipart",
"text",
"video",
];
JSON.stringify(validTypes
.map(type => [type, `table-${type}`])
.map(([type, id]) => [type, document.getElementById(id)])
.map(([type, table]) => [type, table.querySelector('tbody')])
.map(([type, tbody]) => [
type,
Array
.from(tbody.rows)
.map(row => row.cells[0].textContent.trim())
.map(subtype => subtype.split(" ")[0])
])
.reduce((accumulator, [type, subtypes]) => ({
...accumulator,
[type]: (accumulator.type || []).concat(subtypes)
}), {
application: [],
audio: [],
font: [],
image: [],
message: [],
model: [],
multipart: [],
text: [],
video: []
})
)
// Run this script in the browser on https://www.iana.org/assignments/media-type-structured-suffix/media-type-structured-suffix.xml
JSON.stringify(
Array.from(document.querySelectorAll('td'))
.filter(td => /^\+/.test(td.textContent))
.map(td => td.textContent)
.filter(s => !s.includes(' '))
.map(s => s.trim())
)

View File

@ -0,0 +1,622 @@
#!/usr/bin/env node
import {readFileSync, writeFileSync} from 'fs';
import {toFormattedSwitchCase} from './commonUtility.mjs';
import {mediaDocumentations, toDocumentation} from './MediaDocumentations.mjs';
String.prototype.snakeToCamel = function () {
return this.replace(/-(.)/g, (_, m) => m.toUpperCase())
};
String.prototype.firstNumberTreated = function () {
return this.replace(/^\d/, (m) => '_'.concat(m))
}
/** @typedef RawMedia {[key:string]:Array<string>} */
/**
* @typedef RawMediaRecord {{
* type : string,
* tree : Array<string>,
* }}
*/
/**
* @typedef SwiftEnumRecord ({
* name : string,
* cases : Array<{
* case: string,
* value: string
* }>
* })
*/
/** @type {RawMedia}*/
const medias = JSON.parse(readFileSync('./Medias.json').toString());
/** @type {function({type:string, subtypes:string}): RawMediaRecord} */
const toMediaRecord = ({type, subtype}) => ({
type,
tree: subtype.split(';')[0].split('+')[0].split('.')
});
const mediaRecords = Object.freeze(
Object
.keys(medias)
.map(key => medias[key].map(subtype => ({type: key, subtype: subtype})))
.reduce((l, r) => l.concat(r), [])
.map(toMediaRecord)
.filter(r => r.tree.length === 1) // TODO: Rework when support for tree subtypes is added.
);
/**
* @param {string} name
* @returns {{subtype: string, caseName: string}}
*/
function toSubtype(name) {
return {
subtype: name,
caseName: name.snakeToCamel().firstNumberTreated()
}
}
/** @type {Array<{pascalCase:string,lowerCase:string}>} */
const types = mediaRecords
.filter((r, _, l) => l.find(_r => _r.type === r.type) === r)
.map(r => r.type)
.map(type => ({lowerCase: type, pascalCase: type.replace(/^(.)/, (_, m) => m.toUpperCase())}));
types
.map(({pascalCase, lowerCase}) => ({
fileName: pascalCase.concat('.swift'),
code: `import Foundation
${toDocumentation(mediaDocumentations[lowerCase].typeDoc.description, 0)}
public enum ${pascalCase} {
${
mediaRecords
.filter(r => r.type === lowerCase)
.map(r => toSubtype(r.tree[0]))
.filter((c, i, l) => l.findIndex(x => x.caseName === c.caseName) === i)
.map(({subtype, caseName}) => ` /// Represents the \`${subtype}\` subtype.
case ${caseName}(Suffix? = nil, Parameters? = nil)`)
.slice()
.sort((a, b) => a.charCodeAt(0) - b.charCodeAt(0))
.concat(toDocumentation(
mediaDocumentations["generic"].typeDoc.otherCase
.concat([""])
.concat(mediaDocumentations[lowerCase].typeDoc.otherCase),
2)
)
.concat(' case other(String, Suffix? = nil, Parameters? = nil)')
.concat(' case anything(Suffix? = nil, Parameters? = nil)')
.join('\n')
}
}
extension ${pascalCase}: CustomStringConvertible {
public var description: String { rawValue }
}
extension ${pascalCase}: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
${
mediaRecords
.filter(r => r.type === lowerCase)
.map(r => ({
caseName: r.tree[0].snakeToCamel().firstNumberTreated(),
value: r.tree[0]
}))
.filter((r, i, l) => i === l.findIndex(_r => _r.caseName === r.caseName))
.map(({caseName, value}) => [
` case "${value}": `,
`self = .${caseName}(suffix, parameters)`
])
.slice()
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
` case "*": `,
`self = .anything(suffix, parameters)`
]])
.concat([[
` default: `,
`self = .other(subtype, suffix, parameters)`
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
public var rawValue: String {
switch self {
${
mediaRecords
.filter(r => r.type === lowerCase)
.map(r => ({
caseName: r.tree[0].snakeToCamel().firstNumberTreated(),
value: r.tree[0]
}))
.filter((r, i, l) => i === l.findIndex(_r => _r.caseName === r.caseName))
.map(({caseName, value}) => [
` case .${caseName}(let suffix, let parameters): `,
`return "${value}\\(suffix)\\(parameters)"`
])
.slice()
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
' case .other(let value, let suffix, let parameters): ',
'return "\\(value)\\(suffix)\\(parameters)"'
]])
.concat([[
' case .anything(let suffix, let parameters): ',
'return "*\\(suffix)\\(parameters)"'
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
}
extension ${pascalCase}: MediaSubtype { public var type: MediaType { .${lowerCase}(self) } }
extension ${pascalCase}: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
${
mediaRecords
.filter(r => r.type === lowerCase)
.map(r => ({
caseName: r.tree[0].snakeToCamel().firstNumberTreated(),
value: r.tree[0]
}))
.filter((r, i, l) => i === l.findIndex(_r => _r.caseName === r.caseName))
.slice()
.sort((a, b) => a.caseName.charCodeAt(0) - b.caseName.charCodeAt(0))
.map(({caseName, value}) => [
` case .${caseName}(let lhsSuffix, let lhsParameters):`,
` guard case let .${caseName}(rhsSuffix, rhsParameters) = rhs else { return false }`,
` if lhsSuffix != rhsSuffix { return false }`,
` return lhsParameters == rhsParameters`
].join('\n'))
.concat([
' case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):',
' guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }',
' if lhsSubtype.description != rhsSubtype.description { return false }',
' if lhsSuffix != rhsSuffix { return false }',
' return lhsParameters == rhsParameters'
].join('\n'))
.concat([
' case .anything(let lhsSuffix, let lhsParameters):',
' guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }',
' if lhsSuffix != rhsSuffix { return false }',
' return lhsParameters == rhsParameters'
].join('\n'))
.join('\n')
}
}
}
public func hash(into hasher: inout Hasher) {
switch self {
${
mediaRecords
.filter(r => r.type === lowerCase)
.map(r => ({
caseName: r.tree[0].snakeToCamel().firstNumberTreated(),
value: r.tree[0]
}))
.filter((r, i, l) => i === l.findIndex(_r => _r.caseName === r.caseName))
.slice()
.sort((a, b) => a.caseName.charCodeAt(0) - b.caseName.charCodeAt(0))
.map(({caseName}, i) => [
` case .${caseName}(let suffix, let parameters):`,
` hasher.combine(${i})`,
` hasher.combine(suffix)`,
` hasher.combine(parameters)`
].join('\n'))
.concat([
' case .other(let subtype, let suffix, let parameters):',
` hasher.combine(-1)`,
` hasher.combine(subtype.description)`,
` hasher.combine(suffix)`,
` hasher.combine(parameters)`
].join('\n'))
.concat([
' case .anything(let suffix, let parameters):',
` hasher.combine(-2)`,
` hasher.combine(suffix)`,
` hasher.combine(parameters)`
].join('\n'))
.join('\n')
}
}
}
}
`
}))
.forEach(r => writeFileSync(r.fileName, r.code))
writeFileSync(
'MediaType.swift',
`import Foundation
/// A type-safe representation of [Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)s
/// (or formerly known as MIME types).
///
/// You can create a media type in a type-safe manner using one of the possible cases. You can also create
/// media type instances simply using string literals.
///
/// \`\`\`swift
/// let mediaType: MediaType = "application/json" // is equivalent to
/// MediaType.application(.json())
/// \`\`\`
///
/// Media type suffixes and parameters are supported both via string literals and \`\`MediaType\`\` cases.
///
/// \`\`\`swift
/// let mediaType: MediaType = "application/atom; charset=utf-8" // is equivalent to
/// MediaType.application(.atom(nil, ["charset": "utf-8"]))
///
/// let mediaType: MediaType = "application/atom+xml" // is equivalent to
/// MediaType.application(.atom(.xml))
///
/// let mediaType: MediaType = "application/atom+xml; charset=utf-8" // is equivalent to
/// MediaType.application(.atom(.xml, ["charset": "utf-8"]))
/// \`\`\`
///
/// You can create media type trees using either the string literal syntax, or using the \`other\` case of a particular
/// media type.
///
/// \`\`\`swift
/// "application/vnd.efi.img" // is equivalent to
/// MediaType.application(.other("vnd.efi.img"))
/// \`\`\`
public enum MediaType {
${
types
.map(({lowerCase, pascalCase}) => `${toDocumentation(mediaDocumentations[lowerCase].caseDoc, 2)}
case ${lowerCase}(${pascalCase})`)
.join('\n')
}
/// Represents a custom media type that is currently not officially defined.
///
/// Represents a custom media type with the given \`type\` and \`subtype\`. Optionally, you can specify a \`\`Suffix\`\` and
/// \`\`Parameters\`\`.
case other(type: CustomStringConvertible, subtype: CustomStringConvertible, Suffix? = nil, Parameters? = nil)
/// Represents a wildcard media type.
///
/// A wildcard media type has a type of \`*\`. A few examples:
///
/// \`\`\`swift
/// MediaType.anything(.anything()) // Creates: */*
/// MediaType.anything(.other("dialog")) // Creates: */dialog
/// MediaType.anything(.other("response", .xml)) // Creates: */response+xml
/// \`\`\`
case anything(Anything)
}
extension MediaType: CustomStringConvertible {
/// The textual representation of the media type.
///
/// The string form of a media type follows the pattern: \`type/subtype[+suffix][;parameters]\`. A few examples:
///
/// \`\`\`swift
/// MediaType.text(.css()).description // Outputs: text/css
/// MediaType.audio(.ac3(nil, ["rate": 32000])).description // Outputs: audio/ac3;rate=32000
/// MediaType.application(.atom(.xml, ["charset": "utf-8"])).description // Outputs: application/atom+xml;charset=utf-8
/// \`\`\`
public var description: String { rawValue }
}
extension MediaType: RawRepresentable {
/// Creates a media type from its raw string value.
///
/// - Parameter rawValue: The raw string value.
public init(rawValue: String) {
let chunks = rawValue.split(separator: "/", maxSplits: 1)
let rawType = String(chunks.first ?? "*")
let rawSubtype = String(chunks.count > 1 ? chunks[1] : "")
let (subtype, suffix, parameters) = convert(string: rawSubtype)
switch rawType {
${
types
.map(({lowerCase, pascalCase}) => [
` case "${lowerCase}": `,
`self = .${lowerCase}(${pascalCase}(rawValue: rawSubtype))`
])
.concat([[
' case "*": ',
'self = .anything(Anything(rawValue: rawSubtype))'
]])
.concat([[
' default: ',
'self = .other(type: rawType, subtype: subtype, suffix, parameters)'
]])
.slice()
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
/// The raw string value of the media type.
public var rawValue: String {
switch self {
${
types
.map(({lowerCase}) => [
` case .${lowerCase}(let subtype): `,
`return "${lowerCase}/\\(subtype)"`
])
.concat([[
' case .other(let type, let subtype, let suffix, let parameters):',
'return "\\(type)/\\(subtype)\\(suffix)\\(parameters)"'
]])
.concat([[
' case .anything(let anything):',
'return "*/\\(anything)"'
]])
.slice()
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
}
extension MediaType: ExpressibleByStringLiteral {
/// Creates a media type from a string literal.
///
/// Do not call this initializer directly. This rather allows you to use a string literal where you have to provide
/// a \`\`MediaType\`\` node.
public init(stringLiteral value: String) { self.init(rawValue: value) }
}
extension MediaType: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
${
types
.slice()
.sort((a, b) => a.lowerCase.charCodeAt(0) - b.lowerCase.charCodeAt(0))
.map(({lowerCase}) => [
` case .${lowerCase}(let lhs): `,
`if case let .${lowerCase}(rhs) = rhs { return lhs == rhs } else { return false }`
])
.concat([[
' case .anything(let lhs): ',
`if case let .anything(rhs) = rhs { return lhs == rhs } else { return false }`
]])
.map(toFormattedSwitchCase)
.concat([
' case .other(let lhsType, let lhsSubtype, let lhsSuffix, let lhsParameters):',
' guard case let .other(rhsType, rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }',
' if (lhsType.description != rhsType.description) { return false }',
' if (lhsSubtype.description != rhsSubtype.description) { return false }',
' if (lhsSuffix != rhsSuffix) { return false }',
' if (lhsParameters != rhsParameters) { return false }',
' return true'
].join('\n'))
.join('\n')
}
}
}
public func hash(into hasher: inout Hasher) {
switch self {
${
types
.slice()
.sort((a, b) => a.lowerCase.charCodeAt(0) - b.lowerCase.charCodeAt(0))
.map(({lowerCase}, i) => [
` case .${lowerCase}(let subtype):`,
` hasher.combine(${i})`,
' hasher.combine(subtype)'
].join('\n'))
.concat([
' case .anything(let subtype):',
` hasher.combine(-1)`,
' hasher.combine(subtype)'
].join('\n'))
.concat([
' case .other(let type, let subtype, let suffix, let parameters):',
' hasher.combine(-2)',
' hasher.combine(type.description)',
' hasher.combine(subtype.description)',
' hasher.combine(suffix)',
' hasher.combine(parameters)'
].join('\n'))
.join('\n')
}
}
}
}
`);
writeFileSync(
'Anything.swift',
`import Foundation
public enum Anything {
case other(CustomStringConvertible, Suffix? = nil, Parameters? = nil)
case anything(Suffix? = nil, Parameters? = nil)
}
extension Anything: CustomStringConvertible {
public var description: String { rawValue }
}
extension Anything: MediaSubtype { public var type: MediaType { .anything(self) } }
extension Anything: RawRepresentable {
public init(rawValue: String) {
let (subtype, suffix, parameters) = convert(string: rawValue)
switch subtype {
case "*" : self = .anything(suffix, parameters)
default : self = .other(subtype, suffix, parameters)
}
}
public var rawValue: String {
switch self {
case .other(let subtype, let suffix, let params): return "\\(subtype)\\(suffix)\\(params)"
case .anything(let suffix, let params): return "*\\(suffix)\\(params)"
}
}
}
extension Anything: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
case .other(let lhsSubtype, let lhsSuffix, let lhsParameters):
guard case let .other(rhsSubtype, rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSubtype.description != rhsSubtype.description { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
case .anything(let lhsSuffix, let lhsParameters):
guard case let .anything(rhsSuffix, rhsParameters) = rhs else { return false }
if lhsSuffix != rhsSuffix { return false }
return lhsParameters == rhsParameters
}
}
public func hash(into hasher: inout Hasher) {
switch self {
case .other(let subtype, let suffix, let parameters):
hasher.combine(-1)
hasher.combine(subtype.description)
hasher.combine(suffix.description)
hasher.combine(parameters)
case .anything(let suffix, let parameters):
hasher.combine(-2)
hasher.combine(suffix)
hasher.combine(parameters)
}
}
}
`);
writeFileSync(
'Parameters.swift',
`import Foundation
/// Represents parameters of \`\`MediaType\`\`s.
///
/// A media type may have parameters. For example \`text/html;charset=utf-8\` defines a media type with UTF-8 charset
/// instead of the default ASCII.
///
/// You can specify arbitrary parameters to *any* of the \`\`MediaType\`\`s using a Swift
/// [dictionary](https://developer.apple.com/documentation/swift/dictionary). Keep in mind though, that not all such
/// parameter values are registered (see the
/// [official site](https://www.iana.org/assignments/media-types/media-types.xhtml) for details).
///
/// You can specify parameters by using either the Swift DSL or string literal syntax. Parameters in string variables
/// are also supported. The following examples are equivalent:
///
/// \`\`\`swift
/// let mediaType: MediaType = "audio/ac3;rate=32000" // is equivalent to
///
/// let mediaType = MediaType.audio(.ac3(nil, ["rate": 32_000])) // is equivalent to
///
/// let rawMediaType = "audio/ac3;rate=32000"
/// let mediaType = MediaType(rawValue: rawMediaType)
/// \`\`\`
public typealias Parameters = [String: CustomStringConvertible?]
internal extension DefaultStringInterpolation {
@inlinable mutating func appendInterpolation(_ value: Parameters?) {
guard let parameters = value else { return }
if parameters.isEmpty { return }
for (key, value) in parameters {
appendLiteral(";")
appendLiteral(key)
guard let value = value else { continue }
appendLiteral("=")
appendLiteral(value.description)
}
}
}
`);
writeFileSync(
'_Utility.swift',
`import Foundation
internal typealias RawSubtype = (
subtype: String,
suffix: Suffix?,
parameters: Parameters?
)
internal func convert(string rawValue: String) -> RawSubtype {
let chunks = rawValue.split(separator: ";")
let parameterChunks = chunks.count > 1 ? chunks[1...] : []
let parameters: Parameters? = parameterChunks.isEmpty
? nil
: parameterChunks
.map { $0.split(separator: "=") }
.reduce(into: [:]) { (result, parameterChunk) in
if parameterChunk.isEmpty { return }
result?[String(parameterChunk.first!).trimmingCharacters(in: .whitespacesAndNewlines)] = parameterChunk.indices.contains(1)
? parameterChunk[1].trimmingCharacters(in: .whitespacesAndNewlines)
: nil
}
let suffixedChunks = chunks.first?.split(separator: "+")
let subType = suffixedChunks?.first ?? "*"
let suffix = (suffixedChunks?.count ?? 0) > 1
? suffixedChunks?[1] == nil
? nil
: Suffix(rawValue: String(suffixedChunks![1]))
: nil
return (
subtype: String(subType),
suffix: suffix,
parameters: parameters
)
}
func ==(lhs: Parameters, rhs: Parameters) -> Bool {
if lhs.keys != rhs.keys { return false }
for (lhsKey, lhsValue) in lhs {
guard let rhsValue = rhs[lhsKey] else {
if lhsValue != nil {
return false
} else {
continue
}
}
guard let lhsValue = lhsValue else { return false }
if lhsValue.description != rhsValue!.description { return false }
}
return true
}
func !=(lhs: Parameters, rhs: Parameters) -> Bool { !(lhs == rhs) }
func ==(lhs: Parameters?, rhs: Parameters?) -> Bool {
var leftIsNil = false
var rightIsNil = false
if case .none = lhs { leftIsNil = true }
if case .none = rhs { rightIsNil = true }
if leftIsNil || rightIsNil { return leftIsNil == rightIsNil }
return lhs! == rhs!
}
func !=(lhs: Parameters?, rhs: Parameters?) -> Bool { !(lhs == rhs) }
extension Hasher {
@inlinable mutating func combine(_ value: Parameters?) {
guard let value = value else { return }
for (key, value) in value {
combine(key)
combine(value?.description)
}
}
}
`);

View File

@ -0,0 +1,157 @@
#!/usr/bin/env node
import {readFileSync, writeFileSync} from 'fs';
import {toFormattedSwitchCase} from './commonUtility.mjs';
/** @type {Array<string>} */
const suffixes = JSON.parse(readFileSync('./Suffixes.json').toString());
/** @type {{caseName:string,value:string}} */
const records = suffixes
.map(ext => ({
'caseName': ext
.slice(1)
.replace(/-(.)/g, (_, m) => m.toUpperCase()),
'value': ext
}));
const code = `import Foundation
/// Represents the media type [suffix](https://en.wikipedia.org/wiki/Media_type#Suffix)es.
///
/// The library allows all \`\`MediaType\`\`s to have a suffix. Keep in mind though, that not all such combinations are
/// registered (see the [official site](https://www.iana.org/assignments/media-types/media-types.xhtml) for details).
///
/// It is also possible to create completely custom suffixes by using either the \`\`Suffix/other(_:)\`\` case directly or a
/// string literal.
///
/// \`\`\`swift
/// MediaType.application(.jose(.json)) // Creates: application/jose+json
/// MediaType.application(.jose(.other("custom"))) // Creates: application/jose+custom
/// MediaType.image(.svg("zip")) // Creates: image/svg+zip
/// \`\`\`
///
/// You can access a media type's suffix by matching using a \`switch\` statement:
///
/// \`\`\`swift
/// let mediaType = MediaType.application(.calendar(.xml))
/// switch mediaType {
/// case .application(.calendar(let suffix, _)):
/// guard let suffix = suffix else { break }
/// print("Suffix: \\(suffix)", "Suffix: +xml")
/// default:
/// print("Unsupported media type: \\(mediaType)")
/// }
/// \`\`\`
public enum Suffix {
${
records
.map(({caseName, value}) => ` /// Represents the \`${value.substring(1)}\` suffix.
case ${caseName}`)
.join('\n')
}
/// Represents a custom suffix.
case other(CustomStringConvertible)
}
extension Suffix: RawRepresentable {
public init(rawValue: String) {
let rawValue = rawValue.starts(with: "+")
? String(rawValue.split(separator: "+", maxSplits: 1).last!)
: rawValue
switch (rawValue) {
${
records
.map(({caseName, value}) => [
` case "${value.replace(/^\+/, '')}": `,
`self = .${caseName}`
])
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
` default: `,
`self = .other(rawValue)`
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
public var rawValue: String {
switch self {
${
records
.map(({caseName, value}) => [
` case .${caseName}:`,
`return "${value}"`
])
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
" case .other(let value): ",
`return value.description.starts(with: "+") ? value.description : "+\\(value)"`
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
}
extension Suffix: CustomStringConvertible { public var description: String { rawValue } }
extension Optional: CustomStringConvertible where Wrapped == Suffix {
public var description: String {
switch self {
case .none: return ""
case .some(let value): return value.description
}
}
}
extension Suffix: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
self.init(rawValue: value)
}
}
extension Suffix: Hashable {
public static func ==(lhs: Self, rhs: Self) -> Bool {
switch lhs {
${
records
.map(({caseName}) => [
` case .${caseName}: `,
`if case .${caseName} = rhs { return true } else { return false }`
])
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
` case .other(let lhsSuffix): `,
`if case let .other(rhsSuffix) = rhs { return lhsSuffix.description == rhsSuffix.description } else { return false }`
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
public func hash(into hasher: inout Hasher) {
switch self {
${
records
.map(({caseName}, i) => [
` case .${caseName}: `,
`hasher.combine(${i})`
])
.sort(([a], [b]) => a.charCodeAt(0) - b.charCodeAt(0))
.concat([[
` case .other(let other): `,
`hasher.combine(other.description)`
]])
.map(toFormattedSwitchCase)
.join('\n')
}
}
}
}
`
writeFileSync('Suffix.swift', code);

View File

@ -0,0 +1,17 @@
[
"+xml",
"+json",
"+ber",
"+cbor",
"+der",
"+fastinfoset",
"+wbxml",
"+zip",
"+tlv",
"+json-seq",
"+sqlite3",
"+jwt",
"+gzip",
"+cbor-seq",
"+zstd"
]

View File

@ -0,0 +1,10 @@
/** @type {function([string,string], number, Array<[string, string]>>): string} */
export const toFormattedSwitchCase = ([caseColumn, returnColumn], _, l) => caseColumn
.concat(
Array(l
.concat()
.sort(([c1], [c2]) => c2.length - c1.length)[0][0]
.length - caseColumn.length
).fill(" ").join("")
)
.concat(returnColumn);

View File

@ -1,28 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="136" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="136" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h93v20H0z"/>
<path fill="#4c1" d="M93 0h43v20H93z"/>
<path fill="url(#b)" d="M0 0h136v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="475" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="475" y="140" transform="scale(.1)" textLength="830">
documentation
</text>
<text x="1135" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">
100%
</text>
<text x="1135" y="140" transform="scale(.1)" textLength="330">
100%
</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,202 +0,0 @@
/*! Jazzy - https://github.com/realm/jazzy
* Copyright Realm Inc.
* SPDX-License-Identifier: MIT
*/
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

View File

@ -1,416 +0,0 @@
/*! Jazzy - https://github.com/realm/jazzy
* Copyright Realm Inc.
* SPDX-License-Identifier: MIT
*/
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #fff;
font-family: -apple-system, Helvetica, freesans, Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word;
min-height: 100vh; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 400;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
@media screen and (max-width: 767px) {
h1 {
font-size: 1.75em; }
h2 {
font-size: 1.4em; } }
pre, code {
font-family: "SF Mono", Menlo, monospace;
font-size: 0.95em;
color: #777;
word-wrap: normal; }
pre {
line-height: 1.6; }
a {
color: #0088cc;
text-decoration: none; }
a code {
color: inherit; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
hr {
height: 1px;
border: none;
background-color: #e2e2e2; }
.footnote-ref {
display: inline-block;
scroll-margin-top: 87px; }
.footnote-def {
scroll-margin-top: 87px; }
.content-wrapper {
margin: 0 auto;
width: calc(100% - 32px);
max-width: 980px; }
.wrapper {
display: flex;
flex-direction: column;
min-height: inherit;
overflow: auto; }
.article-wrapper > *,
.nav-wrapper > *,
.footer-wrapper > * {
margin: 0 auto;
width: calc(100% - 32px);
max-width: 980px; }
.article-wrapper {
flex: 1;
background-color: #fff; }
.nav-wrapper {
background-color: #fafafa; }
.footer-wrapper {
background-color: #f2f2f2; }
header {
line-height: 48px;
background-color: #2C2C2C;
position: fixed;
width: 100%;
z-index: 3; }
header img {
padding-right: 6px;
vertical-align: -2px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs-container {
background-color: #2C2C2C;
position: fixed;
z-index: 2;
width: 100%; }
#breadcrumbs {
color: rgba(255, 255, 255, 0.6);
height: 29px;
padding-bottom: 10px;
width: 100%;
margin-top: 48px;
white-space: nowrap;
overflow-x: scroll; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
#breadcrumbs a {
color: white; }
@media screen and (max-width: 767px) {
#breadcrumbs {
color: white; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
.nav-group-name {
font-size: 1.5rem;
font-weight: 500;
padding: 20px 0; }
.nav-group-name:not(:last-child) {
border-bottom: 1px solid #e2e2e2; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
column-count: 2;
list-style: none;
padding: 0;
margin-top: 5px; }
.nav-group-task {
font-size: 1.1rem;
font-weight: 400; }
.nav-group-task a {
color: #888; }
@media screen and (max-width: 767px) {
.nav-group-tasks {
column-count: 1; } }
.main-content {
overflow: hidden;
padding-bottom: 60px;
margin-top: 87px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.5; }
.main-content section {
max-width: 750px; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.main-content .section-name p {
margin-bottom: inherit;
line-height: inherit; }
.main-content .section-name code {
color: inherit; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
font-size: 1.5rem;
font-weight: 500;
margin: 0; }
.task-group-section {
margin-top: 10px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-group > ul {
padding-left: 0; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.section-name-container {
position: relative;
display: inline-block; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 55px;
transition: all 300ms; }
.item .discouraged {
text-decoration: line-through; }
.item .token-open {
margin-left: 45px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
position: relative;
background: #f9f9f9;
width: 100%;
padding: 10px 25px;
border: 1px solid #e2e2e2;
border-radius: 8px;
box-sizing: border-box; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 12px;
font-weight: 600;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
padding: 25px 0;
box-sizing: border-box; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs {
display: none; }
html.dash .main-content {
width: calc(100% - 32px);
max-width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
@media screen and (max-width: 767px) {
.no-mobile {
display: none; } }

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIdentifier</key>
<string>com.jazzy.</string>
<key>CFBundleName</key>
<string></string>
<key>DocSetPlatformFamily</key>
<string></string>
<key>isDashDocset</key>
<true/>
<key>dashIndexFilePath</key>
<string>index.html</string>
<key>isJavaScriptEnabled</key>
<true/>
<key>DashDocSetFamily</key>
<string>dashtoc</string>
</dict>
</plist>

View File

@ -1,781 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Enumerations Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Enumerations" class="dashAnchor"></a>
<a title="Enumerations Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Enumerations Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Enumerations</h1>
<p>The following enumerations are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO"></a>
<a name="//apple_ref/swift/Enum/Anything" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO">Anything</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Enums/Anything.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Anything</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType11ApplicationO"></a>
<a name="//apple_ref/swift/Enum/Application" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType11ApplicationO">Application</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>application</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#application">official documentation</a> for details.</p>
<p>You typically use <code>Application</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">application</span> <span class="o">=</span> <span class="kt">Application</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="n">application</span><span class="p">)</span> <span class="c1">// Creates: application/atom+xml;charset=utf-8</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access application values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="kt">Application</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">application</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">cbor</span><span class="p">,</span> <span class="n">_</span><span class="p">),</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">,</span> <span class="n">_</span><span class="p">),</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="n">_</span><span class="p">):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">cbor</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">senml</span><span class="p">(</span><span class="o">.</span><span class="n">zip</span><span class="p">))</span> <span class="c1">// Returns: false</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">application</span><span class="p">:</span> <span class="o">.</span><span class="nf">json</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Application.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Application</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Application</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5AudioO"></a>
<a name="//apple_ref/swift/Enum/Audio" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5AudioO">Audio</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>audio</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#audio">official documentation</a> for details.</p>
<p>You typically use <code>Audio</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">audio</span> <span class="o">=</span> <span class="kt">Audio</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32000</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="n">audio</span><span class="p">)</span> <span class="c1">// Creates: audio/ac3;rate=32000</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access audio values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="kt">Audio</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">audio</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">ac3</span><span class="p">,</span> <span class="o">.</span><span class="n">aac</span><span class="p">,</span> <span class="o">.</span><span class="nv">ogg</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">ac3</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">aac</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">ogg</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mpeg</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Audio.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Audio</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Audio</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO"></a>
<a name="//apple_ref/swift/Enum/Font" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO">Font</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>font</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official documentation</a> for details.</p>
<p>You typically use <code>Font</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">font</span> <span class="o">=</span> <span class="kt">Font</span><span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">font</span><span class="p">(</span><span class="n">font</span><span class="p">)</span> <span class="c1">// Creates: font/ttf;layout=oat,aat</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access font values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="kt">Font</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">font</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">woff</span><span class="p">,</span> <span class="o">.</span><span class="nv">woff2</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="k">let</span> <span class="nv">parameters</span><span class="p">?):</span> <span class="k">return</span> <span class="o">!</span><span class="n">parameters</span><span class="o">.</span><span class="n">isEmpty</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">woff</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">]))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Font.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Font</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ImageO"></a>
<a name="//apple_ref/swift/Enum/Image" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ImageO">Image</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>image</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#image">official documentation</a> for details.</p>
<p>You typically use <code>Image</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">image</span> <span class="o">=</span> <span class="kt">Image</span><span class="o">.</span><span class="nf">png</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="n">image</span><span class="p">)</span> <span class="c1">// Creates: image/png</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access image values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">image</span><span class="p">:</span> <span class="kt">Image</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">image</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">png</span><span class="p">,</span> <span class="o">.</span><span class="n">jpeg</span><span class="p">,</span> <span class="o">.</span><span class="nv">gif</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">png</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">jpeg</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">gif</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">bmp</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Image.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Image</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Image</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO"></a>
<a name="//apple_ref/swift/Enum/MediaType" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO">MediaType</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>A type-safe representation of <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s
(or formerly known as MIME types).</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create
media type instances simply using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>Media type suffixes and parameters are supported both via string literals and <code>MediaType</code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<p>You can create media type trees using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
<a href="Enums/MediaType.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MediaType</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO"></a>
<a name="//apple_ref/swift/Enum/Message" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO">Message</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>message</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official documentation</a> for details.</p>
<p>You typically use <code>Message</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">message</span> <span class="o">=</span> <span class="kt">Message</span><span class="o">.</span><span class="nf">http</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">message</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="c1">// Creates: message/http</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access message values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">message</span><span class="p">:</span> <span class="kt">Message</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">message</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">http</span><span class="p">,</span> <span class="o">.</span><span class="nv">rfc822</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">http</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">rfc822</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">sip</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Message.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Message</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO"></a>
<a name="//apple_ref/swift/Enum/Model" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO">Model</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>model</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official documentation</a> for details.</p>
<p>You typically use <code>Model</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">model</span> <span class="o">=</span> <span class="kt">Model</span><span class="o">.</span><span class="nf">step</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">model</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <span class="c1">// Creates: model/step</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access model values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="kt">Model</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">model</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">step</span><span class="p">,</span> <span class="o">.</span><span class="nv">iges</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">step</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">iges</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mesh</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Model.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Model</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO"></a>
<a name="//apple_ref/swift/Enum/Multipart" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO">Multipart</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multipart</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official documentation</a> for details.</p>
<p>You typically use <code>Multipart</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">multipart</span> <span class="o">=</span> <span class="kt">Multipart</span><span class="o">.</span><span class="nf">formData</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">multipart</span><span class="p">(</span><span class="n">multipart</span><span class="p">)</span> <span class="c1">// Creates: multipart/form-data</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access multipart values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">multipart</span><span class="p">:</span> <span class="kt">Multipart</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">multipart</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">formData</span><span class="p">,</span> <span class="o">.</span><span class="nv">mixed</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">formData</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mixed</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">voiceMessage</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Multipart.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Multipart</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO"></a>
<a name="//apple_ref/swift/Enum/Suffix" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO">Suffix</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the media type <a href="https://en.wikipedia.org/wiki/Media_type#Suffix">suffix</a>es.</p>
<p>The library allows all <code><a href="Enums/MediaType.html">MediaType</a></code>s to have a suffix. Keep in mind though, that not all such combinations are
registered (see the <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>It is also possible to create completely custom suffixes by using either the <code><a href="Enums/Suffix.html#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:)</a></code> case directly or a
string literal.</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Creates: application/jose+json</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"custom"</span><span class="p">)))</span> <span class="c1">// Creates: application/jose+custom</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="s">"zip"</span><span class="p">))</span> <span class="c1">// Creates: image/svg+zip</span>
</code></pre>
<p>You can access a media type&rsquo;s suffix by matching using a <code>switch</code> statement:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="k">let</span> <span class="nv">suffix</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">suffix</span> <span class="o">=</span> <span class="n">suffix</span> <span class="k">else</span> <span class="p">{</span> <span class="k">break</span> <span class="p">}</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Suffix: </span><span class="se">\(</span><span class="n">suffix</span><span class="se">)</span><span class="s">"</span><span class="p">,</span> <span class="s">"Suffix: +xml"</span><span class="p">)</span>
<span class="k">default</span><span class="p">:</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Unsupported media type: </span><span class="se">\(</span><span class="n">mediaType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
<a href="Enums/Suffix.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Suffix</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4TextO"></a>
<a name="//apple_ref/swift/Enum/Text" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4TextO">Text</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>text</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#text">official documentation</a> for details.</p>
<p>You typically use <code>Text</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">text</span> <span class="o">=</span> <span class="kt">Text</span><span class="o">.</span><span class="nf">html</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">text</span><span class="p">(</span><span class="n">text</span><span class="p">)</span> <span class="c1">// Creates: text/html</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access text values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">text</span><span class="p">:</span> <span class="kt">Text</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">text</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">html</span><span class="p">,</span> <span class="o">.</span><span class="nv">css</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">html</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">css</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">javascript</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Text.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Text</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Text</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5VideoO"></a>
<a name="//apple_ref/swift/Enum/Video" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5VideoO">Video</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>video</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#video">official documentation</a> for details.</p>
<p>You typically use <code>Video</code> as a <code><a href="Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">video</span> <span class="o">=</span> <span class="kt">Video</span><span class="o">.</span><span class="nf">mp4</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">video</span><span class="p">(</span><span class="n">video</span><span class="p">)</span> <span class="c1">// Creates: video/mp4</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access video values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">video</span><span class="p">:</span> <span class="kt">Video</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">video</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">mp4</span><span class="p">,</span> <span class="o">.</span><span class="kt">H264</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mp4</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="kt">H264</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">vc1</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="Enums/MediaType.html">MediaType</a></code>
</div>
<a href="Enums/Video.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Video</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Video</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,350 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Anything Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Anything" class="dashAnchor"></a>
<a title="Anything Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Anything Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Anything</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Anything</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Anything</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO5otheryACs23CustomStringConvertible_p_AA6SuffixOSgSDySSsAE_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO5otheryACs23CustomStringConvertible_p_AA6SuffixOSgSDySSsAE_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType8AnythingO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType8AnythingO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,544 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Font Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Font" class="dashAnchor"></a>
<a title="Font Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Font Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Font</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Font</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Font</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>font</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official documentation</a> for details.</p>
<p>You typically use <code>Font</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">font</span> <span class="o">=</span> <span class="kt">Font</span><span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">])</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">font</span><span class="p">(</span><span class="n">font</span><span class="p">)</span> <span class="c1">// Creates: font/ttf;layout=oat,aat</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access font values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="kt">Font</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">font</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">woff</span><span class="p">,</span> <span class="o">.</span><span class="nv">woff2</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="k">let</span> <span class="nv">parameters</span><span class="p">?):</span> <span class="k">return</span> <span class="o">!</span><span class="n">parameters</span><span class="o">.</span><span class="n">isEmpty</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">woff</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"layout"</span><span class="p">:</span> <span class="s">"oat,aat"</span><span class="p">]))</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">font</span><span class="p">:</span> <span class="o">.</span><span class="nf">ttf</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO10collectionyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/collection(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO10collectionyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">collection(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>collection</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">collection</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO3otfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/otf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO3otfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">otf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>otf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">otf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4sfntyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sfnt(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4sfntyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sfnt(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sfnt</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sfnt</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO3ttfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/ttf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO3ttfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">ttf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>ttf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">ttf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4woffyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/woff(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4woffyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">woff(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>woff</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">woff</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO5woff2yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/woff2(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO5woff2yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">woff2(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>woff2</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">woff2</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType4FontO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType4FontO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -1,712 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>MediaType Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/MediaType" class="dashAnchor"></a>
<a title="MediaType Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
MediaType Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>MediaType</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">MediaType</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">MediaType</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>A type-safe representation of <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s
(or formerly known as MIME types).</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create
media type instances simply using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>Media type suffixes and parameters are supported both via string literals and <code>MediaType</code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<p>You can create media type trees using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO11applicationyAbA11ApplicationOcABmF"></a>
<a name="//apple_ref/swift/Element/application(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO11applicationyAbA11ApplicationOcABmF">application(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>application</code> media type.</p>
<p>Represents binary data. Common examples: <code>application/json</code>, <code>application/octet-stream</code>.</p>
<p>For the whole family of <code>application</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#application">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">application</span><span class="p">(</span><span class="kt"><a href="../Enums/Application.html">Application</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5audioyAbA5AudioOcABmF"></a>
<a name="//apple_ref/swift/Element/audio(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5audioyAbA5AudioOcABmF">audio(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>audio</code> media type.</p>
<p>Represents audible data. Common examples: <code>audio/ac3</code>, <code>audio/mpeg</code>.</p>
<p>For the whole family of <code>audio</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#audio">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">audio</span><span class="p">(</span><span class="kt"><a href="../Enums/Audio.html">Audio</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO4fontyAbA4FontOcABmF"></a>
<a name="//apple_ref/swift/Element/font(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO4fontyAbA4FontOcABmF">font(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>font</code> media type.</p>
<p>Represents font or typeface data. Common examples: <code>font/woff</code>, <code>font/ttf</code>.</p>
<p>For the whole family of <code>font</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#font">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">font</span><span class="p">(</span><span class="kt"><a href="../Enums/Font.html">Font</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5imageyAbA5ImageOcABmF"></a>
<a name="//apple_ref/swift/Element/image(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5imageyAbA5ImageOcABmF">image(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>image</code> media type.</p>
<p>Represents image or graphical data. This includes bitmap and vector images, along with animated image formats.
Common examples: <code>image/jpeg</code>, <code>image/apng</code>.</p>
<p>For the whole family of <code>image</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#image">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">image</span><span class="p">(</span><span class="kt"><a href="../Enums/Image.html">Image</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO7messageyAbA7MessageOcABmF"></a>
<a name="//apple_ref/swift/Element/message(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO7messageyAbA7MessageOcABmF">message(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>message</code> media type.</p>
<p>Represents embedded message data. Common examples: <code>message/rfc882</code>, <code>message/http</code>.</p>
<p>For the whole family of <code>message</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">message</span><span class="p">(</span><span class="kt"><a href="../Enums/Message.html">Message</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5modelyAbA5ModelOcABmF"></a>
<a name="//apple_ref/swift/Element/model(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5modelyAbA5ModelOcABmF">model(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>model</code> media type.</p>
<p>Represents 3D modelling data. Common examples: <code>model/step</code>, <code>model/3mf</code>.</p>
<p>For the whole family of <code>model</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">model</span><span class="p">(</span><span class="kt"><a href="../Enums/Model.html">Model</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO9multipartyAbA9MultipartOcABmF"></a>
<a name="//apple_ref/swift/Element/multipart(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO9multipartyAbA9MultipartOcABmF">multipart(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multipart</code> media type.</p>
<p>Represents data formed from multiple components, which may have their individual media types.
Common examples: <code>multipart/form-data</code>, <code>multipart/encrypted</code>.</p>
<p>For the whole family of <code>multipart</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">multipart</span><span class="p">(</span><span class="kt"><a href="../Enums/Multipart.html">Multipart</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO4textyAbA4TextOcABmF"></a>
<a name="//apple_ref/swift/Element/text(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO4textyAbA4TextOcABmF">text(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>text</code> media type.</p>
<p>Represents textual only data. Common examples: <code>text/css</code>, <code>text/html</code>.</p>
<p>For the whole family of <code>text</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#text">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">text</span><span class="p">(</span><span class="kt"><a href="../Enums/Text.html">Text</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5videoyAbA5VideoOcABmF"></a>
<a name="//apple_ref/swift/Element/video(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5videoyAbA5VideoOcABmF">video(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>video</code> media type.</p>
<p>Represents video data. Common examples: <code>video/mp4</code>, <code>video/H264</code>.</p>
<p>For the whole family of <code>video</code> media types consult the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#video">official IANA</a> documentation.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">video</span><span class="p">(</span><span class="kt"><a href="../Enums/Video.html">Video</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO5otheryABs23CustomStringConvertible_p_sAD_pAA6SuffixOSgSDySSsAD_pSgGSgtcABmF"></a>
<a name="//apple_ref/swift/Element/other(type:subtype:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO5otheryABs23CustomStringConvertible_p_sAD_pAA6SuffixOSgSDySSsAD_pSgGSgtcABmF">other(type:<wbr>subtype:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a custom media type that is currently not officially defined.</p>
<p>Represents a custom media type with the given <code>type</code> and <code>subtype</code>. Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and
<code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="nv">type</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">subtype</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8anythingyAbA8AnythingOcABmF"></a>
<a name="//apple_ref/swift/Element/anything(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8anythingyAbA8AnythingOcABmF">anything(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a wildcard media type.</p>
<p>A wildcard media type has a type of <code>*</code>. A few examples:</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">anything</span><span class="p">())</span> <span class="c1">// Creates: */*</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"dialog"</span><span class="p">))</span> <span class="c1">// Creates: */dialog</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">anything</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"response"</span><span class="p">,</span> <span class="o">.</span><span class="n">xml</span><span class="p">))</span> <span class="c1">// Creates: */response+xml</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="kt"><a href="../Enums/Anything.html">Anything</a></span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The textual representation of the media type.</p>
<p>The string form of a media type follows the pattern: <code>type/subtype[+suffix][;parameters]</code>. A few examples:</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">text</span><span class="p">(</span><span class="o">.</span><span class="nf">css</span><span class="p">())</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: text/css</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32000</span><span class="p">]))</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: audio/ac3;rate=32000</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span><span class="o">.</span><span class="n">description</span> <span class="c1">// Outputs: application/atom+xml;charset=utf-8</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8rawValueABSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8rawValueABSS_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a media type from its raw string value.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>rawValue</em>
</code>
</td>
<td>
<div>
<p>The raw string value.</p>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO8rawValueSSvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO8rawValueSSvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The raw string value of the media type.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO13stringLiteralABSS_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO13stringLiteralABSS_tcfc">init(stringLiteral:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Creates a media type from a string literal.</p>
<p>Do not call this initializer directly. This rather allows you to use a string literal where you have to provide
a <code>MediaType</code> node.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaTypeAAO2eeoiySbAB_ABtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaTypeAAO2eeoiySbAB_ABtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Returns a Boolean indicating whether two media types are the same.</p>
<p>Two media types represent the same thing, and thus considered to be equal, if they have the same type, subtype,
<code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,894 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Message Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Message" class="dashAnchor"></a>
<a title="Message Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Message Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Message</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Message</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Message</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>message</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#message">official documentation</a> for details.</p>
<p>You typically use <code>Message</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">message</span> <span class="o">=</span> <span class="kt">Message</span><span class="o">.</span><span class="nf">http</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">message</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> <span class="c1">// Creates: message/http</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access message values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">message</span><span class="p">:</span> <span class="kt">Message</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">message</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">http</span><span class="p">,</span> <span class="o">.</span><span class="nv">rfc822</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">http</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">rfc822</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">sip</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4CPIMyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/CPIM(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4CPIMyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">CPIM(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>CPIM</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="kt">CPIM</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14deliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/deliveryStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14deliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">deliveryStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>delivery-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">deliveryStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO23dispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/dispositionNotification(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO23dispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">dispositionNotification(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>disposition-notification</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">dispositionNotification</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO12externalBodyyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/externalBody(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO12externalBodyyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">externalBody(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>external-body</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">externalBody</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14feedbackReportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/feedbackReport(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14feedbackReportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">feedbackReport(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>feedback-report</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">feedbackReport</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO6globalyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/global(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO6globalyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">global(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">global</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO20globalDeliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalDeliveryStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO20globalDeliveryStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalDeliveryStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-delivery-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalDeliveryStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO29globalDispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalDispositionNotification(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO29globalDispositionNotificationyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalDispositionNotification(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-disposition-notification</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalDispositionNotification</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO13globalHeadersyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/globalHeaders(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO13globalHeadersyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">globalHeaders(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>global-headers</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">globalHeaders</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4httpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/http(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4httpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">http(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>http</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">http</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4imdnyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/imdn(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4imdnyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">imdn(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>imdn</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">imdn</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4newsyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/news(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4newsyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">news(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>news</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">news</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7partialyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/partial(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7partialyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">partial(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>partial</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">partial</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO6rfc822yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/rfc822(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO6rfc822yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">rfc822(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>rfc822</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">rfc822</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO5sHttpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sHttp(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO5sHttpyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sHttp(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>s-http</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sHttp</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO3sipyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sip(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO3sipyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sip(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sip</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sip</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO7sipfragyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/sipfrag(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO7sipfragyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">sipfrag(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sipfrag</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">sipfrag</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO14trackingStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/trackingStatus(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO14trackingStatusyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">trackingStatus(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>tracking-status</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">trackingStatus</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType7MessageO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType7MessageO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,786 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Model Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Model" class="dashAnchor"></a>
<a title="Model Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Model Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Model</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Model</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Model</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>model</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#model">official documentation</a> for details.</p>
<p>You typically use <code>Model</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">model</span> <span class="o">=</span> <span class="kt">Model</span><span class="o">.</span><span class="nf">step</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">model</span><span class="p">(</span><span class="n">model</span><span class="p">)</span> <span class="c1">// Creates: model/step</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access model values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">model</span><span class="p">:</span> <span class="kt">Model</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">model</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">step</span><span class="p">,</span> <span class="o">.</span><span class="nv">iges</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">step</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">iges</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mesh</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4_3mfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/_3mf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4_3mfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">_3mf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>3mf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">_3mf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3e57yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/e57(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3e57yAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">e57(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>e57</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">e57</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO10gltfBinaryyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/gltfBinary(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO10gltfBinaryyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">gltfBinary(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gltf-binary</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">gltfBinary</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4gltfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/gltf(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4gltfyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">gltf(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gltf</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">gltf</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4igesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/iges(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4igesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">iges(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>iges</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">iges</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4meshyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mesh(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4meshyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mesh(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mesh</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mesh</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3mtlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mtl(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3mtlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mtl(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mtl</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mtl</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3objyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/obj(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3objyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">obj(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>obj</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">obj</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4stepyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/step(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4stepyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">step(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>step</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">step</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7stepXmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/stepXml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7stepXmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">stepXml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>step-xml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stepXml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3stlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/stl(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3stlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">stl(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>stl</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">stl</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4vrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/vrml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4vrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">vrml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>vrml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">vrml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO7x3dVrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/x3dVrml(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO7x3dVrmlyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">x3dVrml(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x3d-vrml</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">x3dVrml</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO3x3dyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/x3d(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO3x3dyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">x3d(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x3d</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">x3d</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType5ModelO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType5ModelO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,813 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Multipart Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Multipart" class="dashAnchor"></a>
<a title="Multipart Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Multipart Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Multipart</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Multipart</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">MediaSubtype</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Multipart</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the <code>multipart</code> media type. See the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml#multipart">official documentation</a> for details.</p>
<p>You typically use <code>Multipart</code> as a <code><a href="../Enums/MediaType.html">MediaType</a></code>.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">multipart</span> <span class="o">=</span> <span class="kt">Multipart</span><span class="o">.</span><span class="nf">formData</span><span class="p">()</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">multipart</span><span class="p">(</span><span class="n">multipart</span><span class="p">)</span> <span class="c1">// Creates: multipart/form-data</span>
</code></pre>
<p>You can use standard <code>switch</code> statement to access multipart values.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="nv">multipart</span><span class="p">:</span> <span class="kt">Multipart</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">multipart</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="n">formData</span><span class="p">,</span> <span class="o">.</span><span class="nv">mixed</span><span class="p">:</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">formData</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">mixed</span><span class="p">())</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="nv">audio</span><span class="p">:</span> <span class="o">.</span><span class="nf">voiceMessage</span><span class="p">())</span> <span class="c1">// Returns: false</span>
</code></pre>
<div class="aside aside-see-also">
<p class="aside-title">See also</p>
<code><a href="../Enums/MediaType.html">MediaType</a></code>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO11alternativeyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/alternative(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO11alternativeyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">alternative(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>alternative</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">alternative</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO11appledoubleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/appledouble(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO11appledoubleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">appledouble(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>appledouble</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">appledouble</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO10byterangesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/byteranges(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO10byterangesyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">byteranges(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>byteranges</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">byteranges</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6digestyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/digest(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6digestyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">digest(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>digest</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">digest</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO9encryptedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/encrypted(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO9encryptedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">encrypted(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>encrypted</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">encrypted</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/example(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO7exampleyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">example(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>example</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">example</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8formDatayAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/formData(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8formDatayAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">formData(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>form-data</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">formData</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO9headerSetyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/headerSet(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO9headerSetyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">headerSet(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>header-set</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">headerSet</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO5mixedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/mixed(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO5mixedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">mixed(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>mixed</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">mixed</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO12multilingualyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/multilingual(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO12multilingualyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">multilingual(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>multilingual</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">multilingual</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8parallelyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/parallel(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8parallelyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">parallel(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>parallel</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">parallel</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO7relatedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/related(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO7relatedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">related(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>related</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">related</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6reportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/report(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6reportyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">report(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>report</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">report</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO6signedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/signed(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO6signedyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">signed(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>signed</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">signed</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO12voiceMessageyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/voiceMessage(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO12voiceMessageyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">voiceMessage(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>voice-message</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">voiceMessage</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO13xMixedReplaceyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/xMixedReplace(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO13xMixedReplaceyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">xMixedReplace(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>x-mixed-replace</code> subtype.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">xMixedReplace</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO5otheryACSS_AA6SuffixOSgSDySSs23CustomStringConvertible_pSgGSgtcACmF">other(_:<wbr>_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a subtype that does not fit in the other cases or is currently not officially defined.</p>
<p>You can use this case to define an arbitrary, unregistered subtype with the given name or
to represent a subtype in the non standard tree, e.g. vendor tree or personal tree.</p>
<p>Optionally, you can specify a <code><a href="../Enums/Suffix.html">Suffix</a></code> and <code><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code>.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">String</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF"></a>
<a name="//apple_ref/swift/Element/anything(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO8anythingyAcA6SuffixOSg_SDySSs23CustomStringConvertible_pSgGSgtcACmF">anything(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">anything</span><span class="p">(</span><span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span> <span class="nv">_</span><span class="p">:</span> <span class="kt"><a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></span><span class="p">?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType9MultipartO4typeA2AOvp"></a>
<a name="//apple_ref/swift/Property/type" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType9MultipartO4typeA2AOvp">type</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">type</span><span class="p">:</span> <span class="kt"><a href="../Enums/MediaType.html">MediaType</a></span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,752 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Suffix Enumeration Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Enum/Suffix" class="dashAnchor"></a>
<a title="Suffix Enumeration Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Suffix Enumeration Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Suffix</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">enum</span> <span class="kt">Suffix</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">RawRepresentable</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">ExpressibleByStringLiteral</span></code></pre>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Suffix</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
</div>
</div>
<p>Represents the media type <a href="https://en.wikipedia.org/wiki/Media_type#Suffix">suffix</a>es.</p>
<p>The library allows all <code><a href="../Enums/MediaType.html">MediaType</a></code>s to have a suffix. Keep in mind though, that not all such combinations are
registered (see the <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>It is also possible to create completely custom suffixes by using either the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:)</a></code> case directly or a
string literal.</p>
<pre class="highlight swift"><code><span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="n">json</span><span class="p">))</span> <span class="c1">// Creates: application/jose+json</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">jose</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"custom"</span><span class="p">)))</span> <span class="c1">// Creates: application/jose+custom</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="s">"zip"</span><span class="p">))</span> <span class="c1">// Creates: image/svg+zip</span>
</code></pre>
<p>You can access a media type&rsquo;s suffix by matching using a <code>switch</code> statement:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">calendar</span><span class="p">(</span><span class="k">let</span> <span class="nv">suffix</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">suffix</span> <span class="o">=</span> <span class="n">suffix</span> <span class="k">else</span> <span class="p">{</span> <span class="k">break</span> <span class="p">}</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Suffix: </span><span class="se">\(</span><span class="n">suffix</span><span class="se">)</span><span class="s">"</span><span class="p">,</span> <span class="s">"Suffix: +xml"</span><span class="p">)</span>
<span class="k">default</span><span class="p">:</span>
<span class="nf">print</span><span class="p">(</span><span class="s">"Unsupported media type: </span><span class="se">\(</span><span class="n">mediaType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="p">}</span>
</code></pre>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3xmlyA2CmF"></a>
<a name="//apple_ref/swift/Element/xml" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3xmlyA2CmF">xml</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>xml</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">xml</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4jsonyA2CmF"></a>
<a name="//apple_ref/swift/Element/json" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4jsonyA2CmF">json</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>json</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">json</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3beryA2CmF"></a>
<a name="//apple_ref/swift/Element/ber" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3beryA2CmF">ber</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>ber</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">ber</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4cboryA2CmF"></a>
<a name="//apple_ref/swift/Element/cbor" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4cboryA2CmF">cbor</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>cbor</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cbor</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3deryA2CmF"></a>
<a name="//apple_ref/swift/Element/der" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3deryA2CmF">der</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>der</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">der</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO11fastinfosetyA2CmF"></a>
<a name="//apple_ref/swift/Element/fastinfoset" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO11fastinfosetyA2CmF">fastinfoset</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>fastinfoset</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">fastinfoset</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO5wbxmlyA2CmF"></a>
<a name="//apple_ref/swift/Element/wbxml" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO5wbxmlyA2CmF">wbxml</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>wbxml</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">wbxml</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3zipyA2CmF"></a>
<a name="//apple_ref/swift/Element/zip" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3zipyA2CmF">zip</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>zip</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">zip</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3tlvyA2CmF"></a>
<a name="//apple_ref/swift/Element/tlv" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3tlvyA2CmF">tlv</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>tlv</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">tlv</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7jsonSeqyA2CmF"></a>
<a name="//apple_ref/swift/Element/jsonSeq" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7jsonSeqyA2CmF">jsonSeq</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO4jsonyA2CmF">json</a></code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">jsonSeq</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7sqlite3yA2CmF"></a>
<a name="//apple_ref/swift/Element/sqlite3" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7sqlite3yA2CmF">sqlite3</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>sqlite3</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">sqlite3</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO3jwtyA2CmF"></a>
<a name="//apple_ref/swift/Element/jwt" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO3jwtyA2CmF">jwt</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>jwt</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">jwt</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4gzipyA2CmF"></a>
<a name="//apple_ref/swift/Element/gzip" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4gzipyA2CmF">gzip</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>gzip</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">gzip</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO7cborSeqyA2CmF"></a>
<a name="//apple_ref/swift/Element/cborSeq" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO7cborSeqyA2CmF">cborSeq</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code><a href="../Enums/Suffix.html#/s:9MediaType6SuffixO4cboryA2CmF">cbor</a></code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">cborSeq</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO4zstdyA2CmF"></a>
<a name="//apple_ref/swift/Element/zstd" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO4zstdyA2CmF">zstd</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents the <code>zstd</code> suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="n">zstd</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF"></a>
<a name="//apple_ref/swift/Element/other(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType6SuffixO5otheryACs23CustomStringConvertible_pcACmF">other(_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents a custom suffix.</p>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="k">case</span> <span class="nf">other</span><span class="p">(</span><span class="kt">CustomStringConvertible</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValuexSg03RawB0Qz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(rawValue:)" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValuexSg03RawB0Qz_tcfc">init(rawValue:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SY8rawValue03RawB0Qzvp"></a>
<a name="//apple_ref/swift/Property/rawValue" class="dashAnchor"></a>
<a class="token" href="#/s:SY8rawValue03RawB0Qzvp">rawValue</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">rawValue</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc"></a>
<a name="//apple_ref/swift/Method/init(stringLiteral:)" class="dashAnchor"></a>
<a class="token" href="#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc">init(stringLiteral:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="n">stringLiteral</span> <span class="nv">value</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="p">`</span><span class="nv">Self</span><span class="p">`)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>
</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,159 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Extensions Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Extensions" class="dashAnchor"></a>
<a title="Extensions Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Extensions Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Extensions</h1>
<p>The following extensions are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:Sq"></a>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a class="token" href="#/s:Sq">Optional</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<a href="Extensions/Optional.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Optional</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span> <span class="k">where</span> <span class="kt">Wrapped</span> <span class="o">==</span> <span class="kt"><a href="Enums/Suffix.html">Suffix</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,173 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Optional Extension Reference</title>
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="../js/jquery.min.js" defer></script>
<script src="../js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Extension/Optional" class="dashAnchor"></a>
<a title="Optional Extension Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="../index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="../img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="../index.html"> Reference</a>
<img id="carat" src="../img/carat.png" alt=""/>
</span>
Optional Extension Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Optional</h1>
<div class="declaration">
<div class="language">
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Optional</span><span class="p">:</span> <span class="kt">CustomStringConvertible</span> <span class="k">where</span> <span class="kt">Wrapped</span> <span class="o">==</span> <span class="kt"><a href="../Enums/Suffix.html">Suffix</a></span></code></pre>
</div>
</div>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Available%20where%20%60Wrapped%60%20%3D%3D%20%60Suffix%60"></a>
<a name="//apple_ref/swift/Section/Available where `Wrapped` == `Suffix`" class="dashAnchor"></a>
<div class="section-name-container">
<a class="section-name-link" href="#/Available%20where%20%60Wrapped%60%20%3D%3D%20%60Suffix%60"></a>
<h3 class="section-name"><span>Available where <code>Wrapped</code> == <code><a href="../Enums/Suffix.html">Suffix</a></code></span>
</h3>
</div>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:s23CustomStringConvertibleP11descriptionSSvp"></a>
<a name="//apple_ref/swift/Property/description" class="dashAnchor"></a>
<a class="token" href="#/s:s23CustomStringConvertibleP11descriptionSSvp">description</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">description</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="../Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="../Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="../Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="../Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="../Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,177 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Type Aliases Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Type Aliases" class="dashAnchor"></a>
<a title="Type Aliases Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Type Aliases Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1>Type Aliases</h1>
<p>The following type aliases are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:9MediaType10Parametersa"></a>
<a name="//apple_ref/swift/Alias/Parameters" class="dashAnchor"></a>
<a class="token" href="#/s:9MediaType10Parametersa">Parameters</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Represents parameters of <code><a href="Enums/MediaType.html">MediaType</a></code>s.</p>
<p>A media type may have parameters. For example <code>text/html;charset=utf-8</code> defines a media type with UTF-8 charset
instead of the default ASCII.</p>
<p>You can specify arbitrary parameters to <em>any</em> of the <code><a href="Enums/MediaType.html">MediaType</a></code>s using a Swift
<a href="https://developer.apple.com/documentation/swift/dictionary">dictionary</a>. Keep in mind though, that not all such
parameter values are registered (see the
<a href="https://www.iana.org/assignments/media-types/media-types.xhtml">official site</a> for details).</p>
<p>You can specify parameters by using either the Swift DSL or string literal syntax. Parameters in string variables
are also supported. The following examples are equivalent:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"audio/ac3;rate=32000"</span> <span class="c1">// is equivalent to</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="o">.</span><span class="nf">audio</span><span class="p">(</span><span class="o">.</span><span class="nf">ac3</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"rate"</span><span class="p">:</span> <span class="mi">32_000</span><span class="p">]))</span> <span class="c1">// is equivalent to</span>
<span class="k">let</span> <span class="nv">rawMediaType</span> <span class="o">=</span> <span class="s">"audio/ac3;rate=32000"</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">rawMediaType</span><span class="p">)</span>
</code></pre>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">Parameters</span> <span class="o">=</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kt">CustomStringConvertible</span><span class="p">?]</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,202 +0,0 @@
/*! Jazzy - https://github.com/realm/jazzy
* Copyright Realm Inc.
* SPDX-License-Identifier: MIT
*/
/* Credit to https://gist.github.com/wataru420/2048287 */
.highlight .c {
color: #999988;
font-style: italic; }
.highlight .err {
color: #a61717;
background-color: #e3d2d2; }
.highlight .k {
color: #000000;
font-weight: bold; }
.highlight .o {
color: #000000;
font-weight: bold; }
.highlight .cm {
color: #999988;
font-style: italic; }
.highlight .cp {
color: #999999;
font-weight: bold; }
.highlight .c1 {
color: #999988;
font-style: italic; }
.highlight .cs {
color: #999999;
font-weight: bold;
font-style: italic; }
.highlight .gd {
color: #000000;
background-color: #ffdddd; }
.highlight .gd .x {
color: #000000;
background-color: #ffaaaa; }
.highlight .ge {
color: #000000;
font-style: italic; }
.highlight .gr {
color: #aa0000; }
.highlight .gh {
color: #999999; }
.highlight .gi {
color: #000000;
background-color: #ddffdd; }
.highlight .gi .x {
color: #000000;
background-color: #aaffaa; }
.highlight .go {
color: #888888; }
.highlight .gp {
color: #555555; }
.highlight .gs {
font-weight: bold; }
.highlight .gu {
color: #aaaaaa; }
.highlight .gt {
color: #aa0000; }
.highlight .kc {
color: #000000;
font-weight: bold; }
.highlight .kd {
color: #000000;
font-weight: bold; }
.highlight .kp {
color: #000000;
font-weight: bold; }
.highlight .kr {
color: #000000;
font-weight: bold; }
.highlight .kt {
color: #445588; }
.highlight .m {
color: #009999; }
.highlight .s {
color: #d14; }
.highlight .na {
color: #008080; }
.highlight .nb {
color: #0086B3; }
.highlight .nc {
color: #445588;
font-weight: bold; }
.highlight .no {
color: #008080; }
.highlight .ni {
color: #800080; }
.highlight .ne {
color: #990000;
font-weight: bold; }
.highlight .nf {
color: #990000; }
.highlight .nn {
color: #555555; }
.highlight .nt {
color: #000080; }
.highlight .nv {
color: #008080; }
.highlight .ow {
color: #000000;
font-weight: bold; }
.highlight .w {
color: #bbbbbb; }
.highlight .mf {
color: #009999; }
.highlight .mh {
color: #009999; }
.highlight .mi {
color: #009999; }
.highlight .mo {
color: #009999; }
.highlight .sb {
color: #d14; }
.highlight .sc {
color: #d14; }
.highlight .sd {
color: #d14; }
.highlight .s2 {
color: #d14; }
.highlight .se {
color: #d14; }
.highlight .sh {
color: #d14; }
.highlight .si {
color: #d14; }
.highlight .sx {
color: #d14; }
.highlight .sr {
color: #009926; }
.highlight .s1 {
color: #d14; }
.highlight .ss {
color: #990073; }
.highlight .bp {
color: #999999; }
.highlight .vc {
color: #008080; }
.highlight .vg {
color: #008080; }
.highlight .vi {
color: #008080; }
.highlight .il {
color: #009999; }

View File

@ -1,416 +0,0 @@
/*! Jazzy - https://github.com/realm/jazzy
* Copyright Realm Inc.
* SPDX-License-Identifier: MIT
*/
html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td {
background: transparent;
border: 0;
margin: 0;
outline: 0;
padding: 0;
vertical-align: baseline; }
body {
background-color: #fff;
font-family: -apple-system, Helvetica, freesans, Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
-webkit-font-smoothing: subpixel-antialiased;
word-wrap: break-word;
min-height: 100vh; }
h1, h2, h3 {
margin-top: 0.8em;
margin-bottom: 0.3em;
font-weight: 400;
color: black; }
h1 {
font-size: 2.5em; }
h2 {
font-size: 2em;
border-bottom: 1px solid #e2e2e2; }
h4 {
font-size: 13px;
line-height: 1.5;
margin-top: 21px; }
h5 {
font-size: 1.1em; }
h6 {
font-size: 1.1em;
color: #777; }
@media screen and (max-width: 767px) {
h1 {
font-size: 1.75em; }
h2 {
font-size: 1.4em; } }
pre, code {
font-family: "SF Mono", Menlo, monospace;
font-size: 0.95em;
color: #777;
word-wrap: normal; }
pre {
line-height: 1.6; }
a {
color: #0088cc;
text-decoration: none; }
a code {
color: inherit; }
ul {
padding-left: 15px; }
li {
line-height: 1.8em; }
img {
max-width: 100%; }
blockquote {
margin-left: 0;
padding: 0 10px;
border-left: 4px solid #ccc; }
hr {
height: 1px;
border: none;
background-color: #e2e2e2; }
.footnote-ref {
display: inline-block;
scroll-margin-top: 87px; }
.footnote-def {
scroll-margin-top: 87px; }
.content-wrapper {
margin: 0 auto;
width: calc(100% - 32px);
max-width: 980px; }
.wrapper {
display: flex;
flex-direction: column;
min-height: inherit;
overflow: auto; }
.article-wrapper > *,
.nav-wrapper > *,
.footer-wrapper > * {
margin: 0 auto;
width: calc(100% - 32px);
max-width: 980px; }
.article-wrapper {
flex: 1;
background-color: #fff; }
.nav-wrapper {
background-color: #fafafa; }
.footer-wrapper {
background-color: #f2f2f2; }
header {
line-height: 48px;
background-color: #2C2C2C;
position: fixed;
width: 100%;
z-index: 3; }
header img {
padding-right: 6px;
vertical-align: -2px;
height: 16px; }
header a {
color: #fff; }
header p {
float: left;
color: #999; }
header .header-right {
float: right;
margin-left: 16px; }
#breadcrumbs-container {
background-color: #2C2C2C;
position: fixed;
z-index: 2;
width: 100%; }
#breadcrumbs {
color: rgba(255, 255, 255, 0.6);
height: 29px;
padding-bottom: 10px;
width: 100%;
margin-top: 48px;
white-space: nowrap;
overflow-x: scroll; }
#breadcrumbs #carat {
height: 10px;
margin: 0 5px; }
#breadcrumbs a {
color: white; }
@media screen and (max-width: 767px) {
#breadcrumbs {
color: white; } }
.nav-groups {
list-style-type: none;
padding-left: 0; }
.nav-group-name {
font-size: 1.5rem;
font-weight: 500;
padding: 20px 0; }
.nav-group-name:not(:last-child) {
border-bottom: 1px solid #e2e2e2; }
.nav-group-name > a {
color: #333; }
.nav-group-tasks {
column-count: 2;
list-style: none;
padding: 0;
margin-top: 5px; }
.nav-group-task {
font-size: 1.1rem;
font-weight: 400; }
.nav-group-task a {
color: #888; }
@media screen and (max-width: 767px) {
.nav-group-tasks {
column-count: 1; } }
.main-content {
overflow: hidden;
padding-bottom: 60px;
margin-top: 87px; }
.main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote {
margin-bottom: 1em; }
.main-content p {
line-height: 1.5; }
.main-content section {
max-width: 750px; }
.main-content section .section:first-child {
margin-top: 0;
padding-top: 0; }
.main-content section .task-group-section .task-group:first-of-type {
padding-top: 10px; }
.main-content section .task-group-section .task-group:first-of-type .section-name {
padding-top: 15px; }
.main-content section .heading:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.main-content .section-name p {
margin-bottom: inherit;
line-height: inherit; }
.main-content .section-name code {
color: inherit; }
.highlight {
background-color: #eee;
padding: 10px 12px;
border: 1px solid #e2e2e2;
border-radius: 4px;
overflow-x: auto; }
.declaration .highlight {
overflow-x: initial;
padding: 0 40px 40px 0;
margin-bottom: -25px;
background-color: transparent;
border: none; }
.section-name {
font-size: 1.5rem;
font-weight: 500;
margin: 0; }
.task-group-section {
margin-top: 10px;
border-top: 1px solid #e2e2e2; }
.task-group {
padding-top: 0px; }
.task-group > ul {
padding-left: 0; }
.task-name-container a[name]:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.section-name-container {
position: relative;
display: inline-block; }
.section-name-container .section-name-link {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin-bottom: 0; }
.section-name-container .section-name {
position: relative;
pointer-events: none;
z-index: 1; }
.section-name-container .section-name a {
pointer-events: auto; }
.item {
padding-top: 8px;
width: 100%;
list-style-type: none; }
.item a[name]:before {
content: "";
display: block;
padding-top: 87px;
margin: -87px 0 0; }
.item code {
background-color: transparent;
padding: 0; }
.item .token, .item .direct-link {
display: inline-block;
text-indent: -20px;
padding-left: 3px;
margin-left: 55px;
transition: all 300ms; }
.item .discouraged {
text-decoration: line-through; }
.item .token-open {
margin-left: 45px; }
.item .declaration-note {
font-size: .85em;
color: gray;
font-style: italic; }
.pointer-container {
left: -23px;
padding-bottom: 13px;
position: relative;
width: 110%; }
.pointer {
background: #f9f9f9;
border-left: 1px solid #e2e2e2;
border-top: 1px solid #e2e2e2;
height: 12px;
left: 21px;
top: -7px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
position: absolute;
width: 12px; }
.height-container {
display: none;
position: relative;
width: 100%;
overflow: hidden; }
.height-container .section {
position: relative;
background: #f9f9f9;
width: 100%;
padding: 10px 25px;
border: 1px solid #e2e2e2;
border-radius: 8px;
box-sizing: border-box; }
.aside, .language {
padding: 6px 12px;
margin: 12px 0;
border-left: 5px solid #dddddd;
overflow-y: hidden; }
.aside .aside-title, .language .aside-title {
font-size: 12px;
font-weight: 600;
letter-spacing: 2px;
text-transform: uppercase;
padding-bottom: 0;
margin: 0;
color: #aaa;
-webkit-user-select: none; }
.aside p:last-child, .language p:last-child {
margin-bottom: 0; }
.language {
border-left: 5px solid #cde9f4; }
.language .aside-title {
color: #4b8afb; }
.aside-warning, .aside-deprecated, .aside-unavailable {
border-left: 5px solid #ff6666; }
.aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title {
color: #ff0000; }
.graybox {
border-collapse: collapse;
width: 100%; }
.graybox p {
margin: 0;
word-break: break-word;
min-width: 50px; }
.graybox td {
border: 1px solid #e2e2e2;
padding: 5px 25px 5px 10px;
vertical-align: middle; }
.graybox tr td:first-of-type {
text-align: right;
padding: 7px;
vertical-align: top;
word-break: normal;
width: 40px; }
.slightly-smaller {
font-size: 0.9em; }
#footer {
padding: 25px 0;
box-sizing: border-box; }
#footer p {
margin: 0;
color: #aaa;
font-size: 0.8em; }
html.dash header, html.dash #breadcrumbs {
display: none; }
html.dash .main-content {
width: calc(100% - 32px);
max-width: 980px;
margin-left: 0;
border: none;
width: 100%;
top: 0;
padding-bottom: 0; }
html.dash .height-container {
display: block; }
html.dash .item .token {
margin-left: 0; }
html.dash .content-wrapper {
width: auto; }
html.dash #footer {
position: static; }
@media screen and (max-width: 767px) {
.no-mobile {
display: none; } }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,236 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title> Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title=" Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1 id='mediatype' class='heading'>MediaType</h1>
<h2 id='overview' class='heading'>Overview</h2>
<p>MediaType is a library that can be used to
create <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s in a type-safe manner.</p>
<p>Mainly intended &ndash; although not limited &ndash; to be used in <a href="https://www.swift.org/server">server-side Swift</a>
applications.</p>
<h2 id='creating-media-types' class='heading'>Creating Media Types</h2>
<p>Media types are represented by the <code><a href="Enums/MediaType.html">MediaType</a></code> Swift type.</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create media type
instances simply by using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>It is also possible to create a <code><a href="Enums/MediaType.html">MediaType</a></code> instance from a string variable as shown in the following example.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">rawMediaType</span> <span class="o">=</span> <span class="s">"application/json"</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">rawMediaType</span><span class="p">)</span>
</code></pre>
<h3 id='suffixes-and-parameters' class='heading'>Suffixes and Parameters</h3>
<p>Media type <code><a href="Enums/Suffix.html">Suffix</a></code>es and <code><a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code> are supported both via string literals and <code><a href="Enums/MediaType.html">MediaType</a></code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<h3 id='trees' class='heading'>Trees</h3>
<p>You can create media type trees by using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
<h3 id='unregistered-media-types' class='heading'>Unregistered Media Types</h3>
<p>Using this library you can create all the registered media types. The library is versatile enough to allow you to create
practically <em>any</em> media type, even ones that are <em>not</em> registered. A few examples of such cases:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">image</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"image/svg+gzip"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="o">.</span><span class="n">gzip</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">application</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/myApp+json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"myApp"</span><span class="p">,</span> <span class="o">.</span><span class="n">json</span><span class="p">))</span>
</code></pre>
<h2 id='using-media-types' class='heading'>Using Media Types</h2>
<p>You can use regular <code>switch</code> statements to test for media types and get access to their components. The following example
shows various ways to treat a media type.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="n">_</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="s">"xml"</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="k">let</span> <span class="nv">subtype</span><span class="p">):</span>
<span class="k">switch</span> <span class="n">subtype</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">xml</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json+xml"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json+xml;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom+xml"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom+xml;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom"</span><span class="p">)</span> <span class="c1">// Returns: false</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: false</span>
</code></pre>
<h3 id='string-conversion' class='heading'>String Conversion</h3>
<p>Since <code><a href="Enums/MediaType.html">MediaType</a></code> conforms to
the <a href="https://developer.apple.com/documentation/swift/customstringconvertible"><code>CustomStringConvertible</code></a> protocol it is
pretty straightforward to turn an instance into a string.</p>
<p>You can either call the <code><a href="Enums/MediaType.html#/s:9MediaTypeAAO11descriptionSSvp">description</a></code> computed property or simply embed an instance into an interpolated
string.</p>
<p>For example, you can request the list of available products in JSON from an imaginary store.</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">URLRequest</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">URL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="s">"https://example-store.com/products"</span><span class="p">)</span><span class="o">!</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">contentType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span>
<span class="c1">// The following two statements are equivalent</span>
<span class="n">request</span><span class="o">.</span><span class="nf">setValue</span><span class="p">(</span><span class="s">"Content-Type"</span><span class="p">,</span> <span class="nv">forHTTPHeaderField</span><span class="p">:</span> <span class="s">"</span><span class="se">\(</span><span class="n">contentType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="n">request</span><span class="o">.</span><span class="nf">setValue</span><span class="p">(</span><span class="s">"Content-Type"</span><span class="p">,</span> <span class="nv">forHTTPHeaderField</span><span class="p">:</span> <span class="n">contentType</span><span class="o">.</span><span class="n">description</span><span class="p">)</span>
<span class="k">let</span> <span class="p">(</span><span class="nv">_</span><span class="p">,</span> <span class="nv">response</span><span class="p">)</span> <span class="o">=</span> <span class="k">try</span> <span class="n">await</span> <span class="kt">URLSession</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">for</span><span class="p">:</span> <span class="n">request</span><span class="p">)</span>
</code></pre>
<h3 id='media-types-are-a-href-https-developer-apple-com-documentation-swift-hashable-code-hashable-code-a' class='heading'>Media Types are <a href="https://developer.apple.com/documentation/swift/hashable"><code>Hashable</code></a></h3>
<p>This means you can use <code><a href="Enums/MediaType.html">MediaType</a></code>s in sets or dictionaries. For example, you can define the type of images your
application supports like so:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">supportedImages</span><span class="p">:</span> <span class="kt">Set</span><span class="o">&lt;</span><span class="kt">MediaType</span><span class="o">&gt;</span> <span class="o">=</span> <span class="p">[</span><span class="s">"image/png"</span><span class="p">,</span> <span class="s">"image/gif"</span><span class="p">,</span> <span class="s">"image/jpeg"</span><span class="p">]</span>
</code></pre>
<h3 id='comparing-media-types' class='heading'>Comparing Media Types</h3>
<p>You can also compare media type for equality using the <code>MediaType/==(lhs:rhs:)</code> operator.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">canHandle</span><span class="p">(</span><span class="nv">response</span><span class="p">:</span> <span class="kt">URLResponse</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">mimeType</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="n">mimeType</span> <span class="k">else</span> <span class="p">{</span> <span class="k">return</span> <span class="kc">false</span> <span class="p">}</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">mimeType</span><span class="p">)</span>
<span class="k">return</span> <span class="n">mediaType</span> <span class="o">==</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
<span class="p">}</span>
</code></pre>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,74 +0,0 @@
// Jazzy - https://github.com/realm/jazzy
// Copyright Realm Inc.
// SPDX-License-Identifier: MIT
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,237 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title> Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<meta name="viewport" content="width=device-width, viewport-fit=cover, initial-scale=1.0" />
<meta name="google-site-verification" content="hpaY76FpqCUjN6FjYXxXGLtER5n2qplgoV98C3CegpQ" />
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a title=" Reference"></a>
<header>
<div class="content-wrapper">
<p>
<a href="index.html">Swift MediaType Docs</a>
<span class="no-mobile"> (100% documented)</span>
</p>
<p class="header-right">
<a href="https://github.com/21GramConsulting/MediaType">
<img src="img/gh.png" alt="GitHub"/>
<span class="no-mobile">View on GitHub</span>
</a>
</p>
</div>
</header>
<div id="breadcrumbs-container">
<div class="content-wrapper">
<p id="breadcrumbs">
<span class="no-mobile">
<a href="index.html"> Reference</a>
<img id="carat" src="img/carat.png" alt=""/>
</span>
Reference
</p>
</div>
</div>
<div class="wrapper">
<div class="article-wrapper">
<article class="main-content">
<section>
<section class="section">
<h1 id='mediatype' class='heading'>MediaType</h1>
<h2 id='overview' class='heading'>Overview</h2>
<p>MediaType is a library that can be used to
create <a href="https://www.iana.org/assignments/media-types/media-types.xhtml">Media Type</a>s in a type-safe manner.</p>
<p>Mainly intended &ndash; although not limited &ndash; to be used in <a href="https://www.swift.org/server">server-side Swift</a>
applications.</p>
<h2 id='creating-media-types' class='heading'>Creating Media Types</h2>
<p>Media types are represented by the <code><a href="Enums/MediaType.html">MediaType</a></code> Swift type.</p>
<p>You can create a media type in a type-safe manner using one of the possible cases. You can also create media type
instances simply by using string literals.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
</code></pre>
<p>It is also possible to create a <code><a href="Enums/MediaType.html">MediaType</a></code> instance from a string variable as shown in the following example.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">rawMediaType</span> <span class="o">=</span> <span class="s">"application/json"</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">rawMediaType</span><span class="p">)</span>
</code></pre>
<h3 id='suffixes-and-parameters' class='heading'>Suffixes and Parameters</h3>
<p>Media type <code><a href="Enums/Suffix.html">Suffix</a></code>es and <code><a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a></code> are supported both via string literals and <code><a href="Enums/MediaType.html">MediaType</a></code> cases.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="kc">nil</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/atom+xml; charset=utf-8"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="o">.</span><span class="n">xml</span><span class="p">,</span> <span class="p">[</span><span class="s">"charset"</span><span class="p">:</span> <span class="s">"utf-8"</span><span class="p">]))</span>
</code></pre>
<h3 id='trees' class='heading'>Trees</h3>
<p>You can create media type trees by using either the string literal syntax, or using the <code>other</code> case of a particular
media type.</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/vnd.efi.img"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"vnd.efi.img"</span><span class="p">))</span>
</code></pre>
<h3 id='unregistered-media-types' class='heading'>Unregistered Media Types</h3>
<p>Using this library you can create all the registered media types. The library is versatile enough to allow you to create
practically <em>any</em> media type, even ones that are <em>not</em> registered. A few examples of such cases:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">image</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"image/svg+gzip"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">image</span><span class="p">(</span><span class="o">.</span><span class="nf">svg</span><span class="p">(</span><span class="o">.</span><span class="n">gzip</span><span class="p">))</span>
<span class="k">let</span> <span class="nv">application</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/myApp+json"</span> <span class="c1">// is equivalent to</span>
<span class="kt">MediaType</span><span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">other</span><span class="p">(</span><span class="s">"myApp"</span><span class="p">,</span> <span class="o">.</span><span class="n">json</span><span class="p">))</span>
</code></pre>
<h2 id='using-media-types' class='heading'>Using Media Types</h2>
<p>You can use regular <code>switch</code> statements to test for media types and get access to their components. The following example
shows various ways to treat a media type.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isSupported</span><span class="p">(</span><span class="n">_</span> <span class="nv">mediaType</span><span class="p">:</span> <span class="kt">MediaType</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">switch</span> <span class="n">mediaType</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">atom</span><span class="p">(</span><span class="s">"xml"</span><span class="p">,</span> <span class="n">_</span><span class="p">)):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="k">let</span> <span class="nv">subtype</span><span class="p">):</span>
<span class="k">switch</span> <span class="n">subtype</span> <span class="p">{</span>
<span class="k">case</span> <span class="o">.</span><span class="nf">xml</span><span class="p">(</span><span class="n">_</span><span class="p">,</span> <span class="n">_</span><span class="p">):</span> <span class="k">return</span> <span class="kc">true</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="k">default</span><span class="p">:</span> <span class="k">return</span> <span class="kc">false</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json+xml"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/json+xml;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom+xml"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom+xml;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: true</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom"</span><span class="p">)</span> <span class="c1">// Returns: false</span>
<span class="nf">isSupported</span><span class="p">(</span><span class="s">"application/atom;charset=utf-8"</span><span class="p">)</span> <span class="c1">// Returns: false</span>
</code></pre>
<h3 id='string-conversion' class='heading'>String Conversion</h3>
<p>Since <code><a href="Enums/MediaType.html">MediaType</a></code> conforms to
the <a href="https://developer.apple.com/documentation/swift/customstringconvertible"><code>CustomStringConvertible</code></a> protocol it is
pretty straightforward to turn an instance into a string.</p>
<p>You can either call the <code><a href="Enums/MediaType.html#/s:9MediaTypeAAO11descriptionSSvp">description</a></code> computed property or simply embed an instance into an interpolated
string.</p>
<p>For example, you can request the list of available products in JSON from an imaginary store.</p>
<pre class="highlight swift"><code><span class="k">var</span> <span class="nv">request</span> <span class="o">=</span> <span class="kt">URLRequest</span><span class="p">(</span><span class="nv">url</span><span class="p">:</span> <span class="kt">URL</span><span class="p">(</span><span class="nv">string</span><span class="p">:</span> <span class="s">"https://example-store.com/products"</span><span class="p">)</span><span class="o">!</span><span class="p">)</span>
<span class="k">let</span> <span class="nv">contentType</span><span class="p">:</span> <span class="kt">MediaType</span> <span class="o">=</span> <span class="s">"application/json"</span>
<span class="c1">// The following two statements are equivalent</span>
<span class="n">request</span><span class="o">.</span><span class="nf">setValue</span><span class="p">(</span><span class="s">"Content-Type"</span><span class="p">,</span> <span class="nv">forHTTPHeaderField</span><span class="p">:</span> <span class="s">"</span><span class="se">\(</span><span class="n">contentType</span><span class="se">)</span><span class="s">"</span><span class="p">)</span>
<span class="n">request</span><span class="o">.</span><span class="nf">setValue</span><span class="p">(</span><span class="s">"Content-Type"</span><span class="p">,</span> <span class="nv">forHTTPHeaderField</span><span class="p">:</span> <span class="n">contentType</span><span class="o">.</span><span class="n">description</span><span class="p">)</span>
<span class="k">let</span> <span class="p">(</span><span class="nv">_</span><span class="p">,</span> <span class="nv">response</span><span class="p">)</span> <span class="o">=</span> <span class="k">try</span> <span class="n">await</span> <span class="kt">URLSession</span><span class="o">.</span><span class="n">shared</span><span class="o">.</span><span class="nf">data</span><span class="p">(</span><span class="nv">for</span><span class="p">:</span> <span class="n">request</span><span class="p">)</span>
</code></pre>
<h3 id='media-types-are-a-href-https-developer-apple-com-documentation-swift-hashable-code-hashable-code-a' class='heading'>Media Types are <a href="https://developer.apple.com/documentation/swift/hashable"><code>Hashable</code></a></h3>
<p>This means you can use <code><a href="Enums/MediaType.html">MediaType</a></code>s in sets or dictionaries. For example, you can define the type of images your
application supports like so:</p>
<pre class="highlight swift"><code><span class="k">let</span> <span class="nv">supportedImages</span><span class="p">:</span> <span class="kt">Set</span><span class="o">&lt;</span><span class="kt">MediaType</span><span class="o">&gt;</span> <span class="o">=</span> <span class="p">[</span><span class="s">"image/png"</span><span class="p">,</span> <span class="s">"image/gif"</span><span class="p">,</span> <span class="s">"image/jpeg"</span><span class="p">]</span>
</code></pre>
<h3 id='comparing-media-types' class='heading'>Comparing Media Types</h3>
<p>You can also compare media type for equality using the <code>MediaType/==(lhs:rhs:)</code> operator.</p>
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">canHandle</span><span class="p">(</span><span class="nv">response</span><span class="p">:</span> <span class="kt">URLResponse</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span> <span class="p">{</span>
<span class="k">guard</span> <span class="k">let</span> <span class="nv">mimeType</span> <span class="o">=</span> <span class="n">response</span><span class="o">.</span><span class="n">mimeType</span> <span class="k">else</span> <span class="p">{</span> <span class="k">return</span> <span class="kc">false</span> <span class="p">}</span>
<span class="k">let</span> <span class="nv">mediaType</span> <span class="o">=</span> <span class="kt">MediaType</span><span class="p">(</span><span class="nv">rawValue</span><span class="p">:</span> <span class="n">mimeType</span><span class="p">)</span>
<span class="k">return</span> <span class="n">mediaType</span> <span class="o">==</span> <span class="o">.</span><span class="nf">application</span><span class="p">(</span><span class="o">.</span><span class="nf">json</span><span class="p">())</span>
<span class="p">}</span>
</code></pre>
</section>
</section>
</article>
</div>
<div class="nav-wrapper">
<nav class="nav-bottom">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Enums.html">Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/Anything.html">Anything</a>
</li>
<li class="nav-group-task">
<a href="Enums/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Enums/Audio.html">Audio</a>
</li>
<li class="nav-group-task">
<a href="Enums/Font.html">Font</a>
</li>
<li class="nav-group-task">
<a href="Enums/Image.html">Image</a>
</li>
<li class="nav-group-task">
<a href="Enums/MediaType.html">MediaType</a>
</li>
<li class="nav-group-task">
<a href="Enums/Message.html">Message</a>
</li>
<li class="nav-group-task">
<a href="Enums/Model.html">Model</a>
</li>
<li class="nav-group-task">
<a href="Enums/Multipart.html">Multipart</a>
</li>
<li class="nav-group-task">
<a href="Enums/Suffix.html">Suffix</a>
</li>
<li class="nav-group-task">
<a href="Enums/Text.html">Text</a>
</li>
<li class="nav-group-task">
<a href="Enums/Video.html">Video</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Extensions.html">Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Optional.html">Optional</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Typealiases.html">Type Aliases</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Typealiases.html#/s:9MediaType10Parametersa">Parameters</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="footer-wrapper">
<section id="footer">
<p>&copy; 2022 <a class="link" href="https://21gram.hu" target="_blank" rel="external noopener">21Gram Technology Kft.</a>. All rights reserved. (Last updated: 2022-03-28)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.2</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</div>
</div>
</body>
</html>

View File

@ -1,74 +0,0 @@
// Jazzy - https://github.com/realm/jazzy
// Copyright Realm Inc.
// SPDX-License-Identifier: MIT
window.jazzy = {'docset': false}
if (typeof window.dash != 'undefined') {
document.documentElement.className += ' dash'
window.jazzy.docset = true
}
if (navigator.userAgent.match(/xcode/i)) {
document.documentElement.className += ' xcode'
window.jazzy.docset = true
}
function toggleItem($link, $content) {
var animationDuration = 300;
$link.toggleClass('token-open');
$content.slideToggle(animationDuration);
}
function itemLinkToContent($link) {
return $link.parent().parent().next();
}
// On doc load + hash-change, open any targetted item
function openCurrentItemIfClosed() {
if (window.jazzy.docset) {
return;
}
var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token');
$content = itemLinkToContent($link);
if ($content.is(':hidden')) {
toggleItem($link, $content);
}
}
$(openCurrentItemIfClosed);
$(window).on('hashchange', openCurrentItemIfClosed);
// On item link ('token') click, toggle its discussion
$('.token').on('click', function(event) {
if (window.jazzy.docset) {
return;
}
var $link = $(this);
toggleItem($link, itemLinkToContent($link));
// Keeps the document from jumping to the hash.
var href = $link.attr('href');
if (history.pushState) {
history.pushState({}, '', href);
} else {
location.hash = href;
}
event.preventDefault();
});
// Clicks on links to the current, closed, item need to open the item
$("a:not('.token')").on('click', function() {
if (location == this.href) {
openCurrentItemIfClosed();
}
});
// KaTeX rendering
if ("katex" in window) {
$($('.math').each( (_, element) => {
katex.render(element.textContent, element, {
displayMode: $(element).hasClass('m-block'),
throwOnError: false,
trust: true
});
}))
}

2
js/jquery.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long