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
aces
subtype.Declaration
Swift
case aces(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
avci
subtype.Declaration
Swift
case avci(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
avcs
subtype.Declaration
Swift
case avcs(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
avif
subtype.Declaration
Swift
case avif(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
bmp
subtype.Declaration
Swift
case bmp(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
cgm
subtype.Declaration
Swift
case cgm(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
dicom-rle
subtype.Declaration
Swift
case dicomRle(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
emf
subtype.Declaration
Swift
case emf(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
example
subtype.Declaration
Swift
case example(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
fits
subtype.Declaration
Swift
case fits(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
g3fax
subtype.Declaration
Swift
case g3fax(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
gif
subtype.Declaration
Swift
case gif(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
heic
subtype.Declaration
Swift
case heic(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
heic-sequence
subtype.Declaration
Swift
case heicSequence(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
heif
subtype.Declaration
Swift
case heif(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
heif-sequence
subtype.Declaration
Swift
case heifSequence(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
hej2k
subtype.Declaration
Swift
case hej2k(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
hsj2
subtype.Declaration
Swift
case hsj2(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
ief
subtype.Declaration
Swift
case ief(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jls
subtype.Declaration
Swift
case jls(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jp2
subtype.Declaration
Swift
case jp2(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jpeg
subtype.Declaration
Swift
case jpeg(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jph
subtype.Declaration
Swift
case jph(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jphc
subtype.Declaration
Swift
case jphc(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jpm
subtype.Declaration
Swift
case jpm(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jpx
subtype.Declaration
Swift
case jpx(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxr
subtype.Declaration
Swift
case jxr(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxrA
subtype.Declaration
Swift
case jxrA(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxrS
subtype.Declaration
Swift
case jxrS(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxs
subtype.Declaration
Swift
case jxs(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxsc
subtype.Declaration
Swift
case jxsc(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxsi
subtype.Declaration
Swift
case jxsi(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
jxss
subtype.Declaration
Swift
case jxss(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
ktx
subtype.Declaration
Swift
case ktx(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
ktx2
subtype.Declaration
Swift
case ktx2(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
naplps
subtype.Declaration
Swift
case naplps(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
png
subtype.Declaration
Swift
case png(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
pwg-raster
subtype.Declaration
Swift
case pwgRaster(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
svg
subtype.Declaration
Swift
case svg(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
t38
subtype.Declaration
Swift
case t38(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
tiff
subtype.Declaration
Swift
case tiff(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
tiff-fx
subtype.Declaration
Swift
case tiffFx(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
wmf
subtype.Declaration
Swift
case wmf(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
x-emf
subtype.Declaration
Swift
case xEmf(_: Suffix? = nil, _: Parameters? = nil)
-
Represents the
x-wmf
subtype.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
Suffix
andParameters
.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)