MediaFilter

public struct MediaFilter : OptionSet

A wrapper around kUTType. Eventually these will be replaced by Apple with a Swifty enum, but until then, this simply wraps these values in a strongly typed OptionSet. You can use these when deciding which media types you want the user to select from the UIImagePickerController using the init(source:allow:cameraOverlay:showsCameraControls:didPick:) initializer.

Since it is an OptionSet, you can use array literal syntax to describe more than one media type.

let picker = UIImagePickerController(allow: [.image, .movie]) {_,_ in
    // ...
}
  • Tells the UIImagePickerController to allow images to be seleced.

    Declaration

    Swift

    public static let image: UIImagePickerController.MediaFilter
  • Tells the UIImagePickerController to allow movies to be seleced.

    Declaration

    Swift

    public static let movie: UIImagePickerController.MediaFilter
  • all

    Tells the UIImagePickerController to allow all explicitly supported MediaFilter types to be seleced.

    Declaration

    Swift

    public static let all: UIImagePickerController.MediaFilter