title: How to utilize Xamarin Forms Global Styles in iOS Extension
body: <p>I've got a theme switcher in my Xamarin Forms app that works great using a set of static Resource files.  However, my app also has an iOS extension and the theming breaks down at that point.</p>
  <p>In the main application, I am assigning the theme to the current application's Resources property (ie. Global Styles) and all views utilize the resources and automatically change when the theme changes. Something like so:</p>
  <pre class="lang-c# prettyprint-override"><code>Application.Current.Resources = new MyThemes.Default();
  </code></pre>
  <p>In the extension however, there is no &quot;Application&quot; as pages are just added directly to the root UIViewController.  Because of that, I can't use Application.Current, which is always null.  The pages work fine, but no theme is applied.  I can use the themes if I manually assign them to each page as I create them, though it doesn't act like Global Styles and cascade down to child pages.  In other words, something like this:</p>
  <pre class="lang-c# prettyprint-override"><code>var myPage = new ContentPage();
  myPage.Resources = new MyThemes.Default();
  viewController = myPage.CreateViewController();
  </code></pre>
  <p>This works, but it's not perfect and would require me to rewrite portions of shared views that currently are styled automatically by the Global Styles.</p>
  <p>I've been digging around trying to find a clue to implement this proper, but haven't had any luck and feel like I'm missing something.  Everything I've found only seems to talk about themes from a core application point and not extensions.</p>
  <p>Are there documentation or examples on using Theme Resources and Global Styles in a Xamarin Forms iOS Extensions?  Any help is appreciated, thanks!</p>
  <p>Edit:  It's also worth noting that references to Application.Current in custom renderers cause silent crashes when the custom renderer is loaded as an extension. This can be fixed by using a BindableProperty instead.</p>