-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create iOS extensions with Fabulous #12
Comments
Hi Ben, Fabulous works on top of Xamarin.Forms, so it could theoretically run anywhere XF is supported. Today, Fabulous doesn't support it as the program loop is tied to a Xamarin.Forms.Application instance which a share extension wouldn't have. That said, I have already validated that we can make Fabulous work against any XF control instead of just a Xamarin.Forms.Application. (see fabulous-dev/Fabulous#738 (comment)) Didn't had time to integrate that new feature for now, but if you want, you can make your own Fabulous We would gladly accept a PR if that's the case. For the modification, see this code: Fabulous will consume the Then you can write a few functions to be able to write You would write your Fabulous app as usual, except for the module ShareExt =
type Model = ...
type Msg = ...
let init () = ...
let update msg model = ...
let view model dispatch =
View.Grid(...) // Here, make sure you don't use a Page but a Control directly since the parent will be a ContentPage
type MyShareExtContentPage() as this =
inherit Xamarin.Forms.ContentPage()
let runner =
XamarinFormsProgram.mkProgram init update view
|> XamarinFormsProgram.runContentPage this Then in your share extension, you can write member this.ViewDidLoad() =
global::Xamarin.Forms.Forms.Init()
let xfPage = new MyShareExtContentPage()
let newController = xfPage.CreateViewController()
this.PresentModalViewController(newController, false) |
Thanks for the incredibly detailed response. I will try it out and submit a PR if it works as well as described. |
I suggest having some documentation for running any XF component as a Fabulous program. Seems like a very useful thing to know. |
It's not an official feature yet. Only something I know is possible for simple use cases. But it's a planned feature. Once we add it, the documentation will be available as well. :) |
OK I understand. Well, looks like it works, I haven't done any dynamic views yet but static ones work. |
Hi, I am trying to create a Share Extension for a Fabulous app. The process of creating these extensions are explained here: https://docs.microsoft.com/en-us/xamarin/ios/platform/extensions
I am wondering how to create and call a Fabulous program loop from these extensions. Are there any existing samples of this and/or do we know if this feasible to do with a Fabulous approach vs native or Xamarin.Forms?
Thanks for the help,
Ben
The text was updated successfully, but these errors were encountered: