Deprecated Warning: safeHtml I'm getting a Deprecated Warning on the property safeHtml:


  The embedded asset property safeHtml is now deprecated. Use a
  combination of the isSafe() method and the code property instead.


This is picked up on line 4 and 11 of the code below:

        {# if video embed #}
        {% if embed.type == 'video' %}
            &lt;div class="aspect-ratio aspect-ratio--16x9"&gt;
                {% set vidcode = embed.isSafe() | trim('&lt;iframe') %}
                {% set vid = '&lt;iframe class="aspect-ratio--object" ' ~ vidcode %}
                {{ vid|raw }}
            &lt;/div&gt;
        {# else if rich embed #}
        {% else %}
            &lt;div class="w-100 w-75-ns center"&gt;
                {{ embed.isSafe()|raw }}
            &lt;/div&gt;
        {% endif %}


How do I update this code correctly to remove the warning?
Since it appears that you are using Craft CMS 3, you can try the purify filter. 

In your code, change this line:

{% set vidcode = embed.isSafe() | trim('&lt;iframe') %}


To something like:

{% set vidcode = embed | purify | trim('&lt;iframe') %}


Documentation: