iOS) 사진앨범의 이미지들을 앨범에 가져올때 사용되는 함수 및 프레임워크

2022. 1. 24. 16:12iOS/iOS

728x90
반응형

PhotoKit

Work with image and video assets managed by the Photos app, including those from iCloud Photos and Live Photos.

Photos 프레임워크와 PhotosUI프레임워크를 가지고 있는 프레임워크

 

Using PhotoKit, you can fetch and cache assets for display and playback, edit image and video content, or manage collections of assets such as albums, Moments, and Shared Albums.

PhotoKit을 사용하면 표시 및 재생을 위한 자산을 가져와 캐시하고, 이미지 및 비디오 콘텐츠를 편집하거나, 앨범, 순간 및 공유 앨범과 같은 자산 컬렉션을 관리할 수 있습니다.

 

fetchAssets(with: )

지정된 옵션과 일치하는 모든 자산을 가져옵니다

Retrieves all assets matching the specified options.

 

requestImage(for:targetSize:contentMode:options:resultHandler:)

Declaration

지정된 asset에 대한 이미지 표현을 요청합니다

Requests an image representation for the specified asset.

 

iOS, iPadOS, Mac Catalyst, tvOS

func requestImage(for asset: PHAsset, 
       targetSize: CGSize, 
      contentMode: PHImageContentMode, 
          options: PHImageRequestOptions?, 
    resultHandler: @escaping (UIImage?, [AnyHashable : Any]?) -> Void) -> PHImageRequestID

asset:

로드 된 이미지 데이터

The asset whose image data is to be loaded.

 

targetSize:

반환할 이미지의 크기

The target size of image to be returned.

 

contentMode:

이미지를 요청한 크기의 종횡비에 맞추는 방법에 대한 옵션

An option for how to fit the image to the aspect ratio of the requested size. For details, see PHImageContentMode.

 

options:

사진에서 요청을 처리하고, 요청된 이미지의 형식을 지정하고, 진행 상황이나 오류를 앱에 알리는 방법을 지정하는 옵션입니다.

Options specifying how Photos should handle the request, format the requested image, and notify your app
of progress or errors. For details, see
 PHImageRequestOptions.

 

resultHandler:

이미지 로드가 완료되면 호출되는 블록으로 요청된 이미지 또는 요청 상태에 대한 정보를 제공합니다.

A block to be called when image loading is complete, providing the requested image or information about the status of the request. The block takes the following parameters:

result: The requested image.

info: A dictionary providing information about the status of the request. See Image Result Info Keys for possible keys and values.

 

 

728x90
반응형