Can I embed a LivePhoto in Xcode as an asset?

Upon launch of my app I would like to show a certain LivePhoto within a PHLivePhotoView. Neither dragging a photo from Photos to Xcode, nor Importing to the asset file bring expected results.


1. How should I include the photo in Assets.xcassets?

2. Is it possible at all?

Accepted Reply

This thread has been deleted

>So it seems that one can not embed a LivePhoto in Xcode 'asset catalog'/Assets.xcassets


Again, no, you can't add an LP to an asset catalog/Assets.xcassets.


'add' is defined in this example as copy/paste/embed/drag~drop/import/alias/link/place/move or otherwise work with for any purpose, including but not limited to, those already outlined in this thread.

Replies

1. I would just dump it/them (jpeg and movie files) into the root level of the project, same as a movie file

2. Yes* it is possible to use a Live Photo image in an iOS app. If you haven't yet, pls. see the docs:


Displaying Live Photos

Overview


The

PHLivePhotoView
class provides a way to display Live Photos—pictures, taken on compatible hardware, that include motion and sound from the moments just before and after their capture. A Live Photo view provides the same interactive playback features found in the Photos app.


In iOS and tvOS, you can fetch Live Photo objects to display in a Live Photo view with the

PHLivePhoto
class in the Photos framework. In macOS, the
PHLivePhoto
class provides access to Live Photos being edited in a photo editing extension for the Photos app.

To display Live Photo content on the web, use the LivePhotosKit JS framework.


Don't forget to confirm that the Photos framework has been added to your project.


*As for making this your launch screen, I'd not approach that event w/this asset, but perhaps treat it as an opening video, post-launch. See the iOS HIGs on launchstoryboards and how Apple expects them to be implemented/behave.