Application

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

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

You typically use Application as a MediaType.

let application = Application.atom(.xml, ["charset": "utf-8"])
let mediaType = MediaType.application(application) // Creates: application/atom+xml;charset=utf-8

You can use standard switch statement to access application values.

func isSupported(application: Application) -> Bool {
  switch application {
  case .senml(.cbor, _), .senml(.json, _), .senml(.xml, _): return true
  default: return false
  }
}

isSupported(application: .senml(.cbor)) // Returns: true
isSupported(application: .senml(.json)) // Returns: true
isSupported(application: .senml(.xml)) // Returns: true
isSupported(application: .senml(.zip)) // Returns: false
isSupported(application: .json()) // Returns: false

See also

MediaType