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: MediaFilter = 1
-
Tells the UIImagePickerController to allow movies to be seleced.
Declaration
Swift
public static let movie: MediaFilter = 2