Deserialization
Restoring a settings file#
To restore an editor instance to a previous state, we load the saved instance as serialized settings from our main bundle and wrap it in a Data
object.
It would, of course, also be possible to make a request and load these settings from a remote URL (compare Open Video from Remote URL).
The deserialize
method of the Deserializer
class takes those serialized settings as an argument and returns a result set that exposes an PhotoEditModel
instance.
This photoEditModel
is then used to initialize a new VideoEditViewController
instance alongside some video to which the edits will be applied.
Note that if you are unsure whether the aspect ratio of the video that the serialized settings are applied to match the video that they are derived from, you should pass the video's dimensions explicitly to the deserializer. This ensures that all dimensions and positions are matched as expected.