Skip to content

Instantly share code, notes, and snippets.

View Kharauzov's full-sized avatar
👨‍💻
Focusing

Serhii Kharauzov Kharauzov

👨‍💻
Focusing
  • Warsaw, Poland
View GitHub Profile
@Kharauzov
Kharauzov / PHPhotoLibrary+PhotoAsset.swift
Last active November 25, 2024 18:33 — forked from ricardopereira/PHPhotoLibrary+PhotoAsset.swift
Updated version of extension, adopted to Swift 5. Added functional to save array of assets. Modify saving of one asset, making it universal for both images via UIImage and videos via URLs.
import Photos
extension PHPhotoLibrary {
typealias PhotoAsset = PHAsset
typealias PhotoAlbum = PHAssetCollection
static func saveAssets(_ assets: [Any], albumName: String, completion: @escaping ([PHAsset]?)->()) {
if let album = self.findAlbum(albumName: albumName) {
saveAssets(assets, album: album, completion: completion)