ContentType
public class ContentType
A set of APIs to work with Content-Type headers, whether to generate the value or to determine if it’s an acceptable value.
-
Shared singleton instance.
Declaration
Swift
public static let sharedInstance = ContentType()
-
Get the content type for the given file extension.
Parameter
Parameter forExtension: the file extension.Returns
an Optional String for the content type.Declaration
Swift
public func getContentType(forExtension ext: String) -> String?
Parameters
forExtension
the file extension.
Return Value
an Optional String for the content type.
-
Get the content type for the given file based on its extension.
Parameter
Parameter forFileName: the file name.Returns
an Optional String for the content type.Declaration
Swift
public func getContentType(forFileName fileName: String) -> String?
Parameters
forFileName
the file name.
Return Value
an Optional String for the content type.
-
Check if the message content type matches the type descriptor.
Parameter
Parameter messageContentType: the content type.Parameter
Parameter ofType: the description of the type.Returns
true if the types matched.Declaration
Swift
public func isContentType(_ messageContentType: String, ofType typeDescriptor: String) -> Bool
Parameters
messageContentType
the content type.
ofType
the description of the type.
Return Value
true if the types matched.