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.

    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.

    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.

    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.