Text

public enum Text
extension Text: CustomStringConvertible
extension Text: RawRepresentable
extension Text: MediaSubtype
extension Text: Hashable

Represents the text media type. See the official documentation for details.

You typically use Text as a MediaType.

let text = Text.html()
let mediaType = MediaType.text(text) // Creates: text/html

You can use standard switch statement to access text values.

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

See also

MediaType