Swift相册照片选择-支持单选或多选

//
//  NAPublishAlbumTableViewController.swift
////
//  Created by  on 2019/3/23.
//  Copyright © 2019年 . All rights reserved.
//

import UIKit
import Photos

typealias HandlePhotos = ([PHAsset], [UIImage]) -> Void
class HandleSelectionPhotosManager: NSObject {
    static let share = HandleSelectionPhotosManager()
    
    var maxCount: Int = 0
    var callbackPhotos: HandlePhotos?
    
    private override init() {
        super.init()
    }
    
    func getSelectedPhotos(with count: Int, callback completeHandle: HandlePhotos? ) {
        // 限制长度
        maxCount = count < 1 ? 1 : (count > 9 ? 9 : count)
        self.callbackPhotos = completeHandle
    }
}

/// 后期可用来对相应的英文文件夹修改为汉语名,暂时未使用
enum AlbumTransformChina: String {
    case Favorites
    case RecentlyDeleted = "Recently Deleted"
    case Screenshots
    
    func chinaName() -> String {
        switch  self {
        case .Favorites:
            return "最爱"
        case .RecentlyDeleted:
            return "最近删除"
        case .Screenshots:
            return "手机截屏"
        }
    }
}


/// - albumAllPhotos: 所有
/// - albumSmartAlbums: 智能
/// - albumUserCollection: 收藏
enum AlbumSession: Int {
    case albumAllPhotos = 0
    case albumSmartAlbums
    case albumUserCollection
    
    static let count = 2
}
class NAPublishAlbumTableViewController : UITableViewController{
    // MARK: - 
上一篇:IOS tableview 使用


下一篇:mysql_8 yum安装教程