14 lines
376 B
Swift
14 lines
376 B
Swift
|
|
import Foundation
|
||
|
|
import Photos
|
||
|
|
|
||
|
|
@MainActor
|
||
|
|
final class BackupViewModel: ObservableObject {
|
||
|
|
@Published var photosAuthStatus: PHAuthorizationStatus = PHPhotoLibrary.authorizationStatus(for: .readWrite)
|
||
|
|
|
||
|
|
private let photoService = PhotoLibraryService()
|
||
|
|
|
||
|
|
func requestPhotosAccess() async {
|
||
|
|
photosAuthStatus = await photoService.requestAuthorization()
|
||
|
|
}
|
||
|
|
}
|