, , , . .
:
class FileUploader {
uploadingFiles: [String]
func uploadFile(path: String) -> Task {
uploadingFiles.add(path)
runInBackground({
runInMainThread({
uploadingFiles.remove(path)
if error {
NSNotificationsCenter.default().post('UploadingError', error)
} else {
NSNotificationsCenter.default().post('FileUploaded', path)
}
})
})
}
}
, , AppDelegate. , , ( NSNotificationCenter ViewWillAppear ViewDidDisappear). AppDelegate .
( ) .
s3 - , , ( s3, , ).
Resizing
You can simply show a warning that the file is too large (if> 10 MB for a photo or 100 MB for a video). Later, if you have enough time, you can always try resizing images / videos before uploading - not a bad idea.
source
share