Image
public enum Image
extension Image: CustomStringConvertible
extension Image: RawRepresentable
extension Image: MediaSubtype
extension Image: Hashable
Represents the image media type. See the
official documentation for details.
You typically use Image as a MediaType.
let image = Image.png()
let mediaType = MediaType.image(image) // Creates: image/png
You can use standard switch statement to access image values.
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
See also
MediaType
-
Represents the
acessubtype.Declaration
Swift
case aces(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
avcisubtype.Declaration
Swift
case avci(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
avcssubtype.Declaration
Swift
case avcs(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
avifsubtype.Declaration
Swift
case avif(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
bmpsubtype.Declaration
Swift
case bmp(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
cgmsubtype.Declaration
Swift
case cgm(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
dicom-rlesubtype.Declaration
Swift
case dicomRle(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
emfsubtype.Declaration
Swift
case emf(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
examplesubtype.Declaration
Swift
case example(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
fitssubtype.Declaration
Swift
case fits(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
g3faxsubtype.Declaration
Swift
case g3fax(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
gifsubtype.Declaration
Swift
case gif(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
heicsubtype.Declaration
Swift
case heic(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
heic-sequencesubtype.Declaration
Swift
case heicSequence(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
heifsubtype.Declaration
Swift
case heif(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
heif-sequencesubtype.Declaration
Swift
case heifSequence(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
hej2ksubtype.Declaration
Swift
case hej2k(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
hsj2subtype.Declaration
Swift
case hsj2(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
iefsubtype.Declaration
Swift
case ief(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jlssubtype.Declaration
Swift
case jls(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jp2subtype.Declaration
Swift
case jp2(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jpegsubtype.Declaration
Swift
case jpeg(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jphsubtype.Declaration
Swift
case jph(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jphcsubtype.Declaration
Swift
case jphc(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jpmsubtype.Declaration
Swift
case jpm(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jpxsubtype.Declaration
Swift
case jpx(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxrsubtype.Declaration
Swift
case jxr(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxrAsubtype.Declaration
Swift
case jxrA(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxrSsubtype.Declaration
Swift
case jxrS(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxssubtype.Declaration
Swift
case jxs(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxscsubtype.Declaration
Swift
case jxsc(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxsisubtype.Declaration
Swift
case jxsi(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
jxsssubtype.Declaration
Swift
case jxss(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
ktxsubtype.Declaration
Swift
case ktx(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
ktx2subtype.Declaration
Swift
case ktx2(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
naplpssubtype.Declaration
Swift
case naplps(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
pngsubtype.Declaration
Swift
case png(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
pwg-rastersubtype.Declaration
Swift
case pwgRaster(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
svgsubtype.Declaration
Swift
case svg(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
t38subtype.Declaration
Swift
case t38(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
tiffsubtype.Declaration
Swift
case tiff(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
tiff-fxsubtype.Declaration
Swift
case tiffFx(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
wmfsubtype.Declaration
Swift
case wmf(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
x-emfsubtype.Declaration
Swift
case xEmf(_: Suffix? = nil, _: Parameters? = nil) -
Represents the
x-wmfsubtype.Declaration
Swift
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
SuffixandParameters.Declaration
Swift
case other(String, _: Suffix? = nil, _: Parameters? = nil) -
Declaration
Swift
case anything(_: Suffix? = nil, _: Parameters? = nil) -
Declaration
Swift
public var description: String { get } -
Declaration
Swift
public init(rawValue: String) -
Declaration
Swift
public var rawValue: String { get } -
Declaration
Swift
public var type: MediaType { get } -
Declaration
Swift
public static func == (lhs: `Self`, rhs: `Self`) -> Bool -
Declaration
Swift
public func hash(into hasher: inout Hasher)