PHAsset in Swift


PHAsset library has deprecated in iOS9, and Apple introduces new framework ‘Photos Framework’ for retrieve assets for display and playback, edit image or video content, or work with collections of assets such as album, moments, and iCloud Shared Album.

The first thing you need to do is to fetch the asset or assets. You can choose between either collecting one asset (photo or video), a collection of them, all assets of a certain media type or a media with a certain identifier or URL.

It is important to remember that this class won’t fetch the actual media (photo, video, audio), but the metadata of the media.

After you, they fetched the assets you can either gather metadata about them to use or you can also edit the metadata or the assets.​

So what data can you actually get after you have fetched the asset(s). Here is a quick list:

Here I am going to show how to fetch gallery data and fetch the image using Assert.

First Galley fetch.

Now Image fetches from Assert.

I hope it will help everyone.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Lilia Chmola
    thank you very much!:)
  • Chris Hornberger
    Why is let imageAsset = … singular. It’s the array of the fetched assets. The code kept confusing me until I re-read it like 8 times 🙂
    • Debabrata Roy (Moderator)
      Thanks for the reply.
      I have used self.imageAssets to store the images for further operation.
  • css.php

    It was a successful collaboration. The Mobikul team provided the client everything they needed in a timely and high-quality manner. They were very professional, reliable, and accessible during the entire process. The client also saw no room for any improvements in the vendor's performance.

    Vincenzo Carrano

    Vincenzo Carrano

    Administrator, Segshop

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home