First, there are
import MobileCoreServices
let imagepicker = UIImagePickerController()
imagepicker.mediaTypes = [ String(kUTTypeMovie) ] It is no longer recommended to use kUTTypeMoive, and this way of writing is also not recommended.
警告:'kUTTypeMovie' was deprecated in xrOS 1.0: Use UTTypeMovie or UTType.movie instead.
According to the warning, if you directly assign
imagepicker.mediaTypes = [ String(UTType.movie) ] 或者
imagepicker.mediaTypes = [UTType.movie as String] is problematic.
The former error: No exact matches in call to initializer
The latter gives an error: Cannot convert value of type 'UTType' to type 'String' in coercion
The main UTType is a structure, and the bull's head is wrong.
Correct spelling:
imagepicker.mediaTypes = [UTType.movie.identifier]