Skip to content
Elmish for Xamarin.Forms
F# C# Other
Branch: adaptive
Clone or download
Pull request Compare This branch is 44 commits ahead, 13 commits behind fsprojects:master.
Latest commit 266e3eb Nov 29, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.nuget Merge branch 'master' into xf35update May 15, 2019
.paket
Fabulous.CodeGen fix list data binding Nov 25, 2019
Fabulous.StaticView fixes to AllControls for use with VS Mac F# 4.5 Nov 27, 2019
Fabulous.XamarinForms integrate with master Nov 29, 2019
docs Update docs for ListView/CollectionView and TableView Nov 22, 2019
src integrate with master Nov 29, 2019
tests
.gitignore
DEVGUIDE.md Bold instead of title Jul 31, 2019
Directory.Build.props reduce diff Nov 11, 2019
FABULOUS.md Update FABULOUS.md Jul 6, 2019
Fabulous.sln integrate with master Nov 29, 2019
LICENSE.md rename Sep 7, 2018
Packages.targets integrate with master Nov 29, 2019
README.md
RELEASE_NOTES.md 0.50.3 Nov 9, 2019
SourceLink.props SourceLink.props Sep 27, 2018
azure-pipeline-osx-setup.sh Update Paket and XCode Oct 26, 2019
azure-pipelines-full.yml . Oct 26, 2019
azure-pipelines-pr.yml
build.cmd Merge branch 'master' into xf35update May 15, 2019
build.fsx lots of work on codegen and update logic Nov 1, 2019
build.proj make GTK and Droid compile and run Nov 26, 2019
build.sh Merge branch 'master' into xf35update May 15, 2019
netfx.props update dependencies and add SkiaSharp sample to AllControls Nov 26, 2019
paket.dependencies integrate with master Nov 29, 2019
paket.lock
paket.references Merge branch 'master' into xf35update May 15, 2019

README.md

Fabulous (Adaptive version)

F# Functional App Development, using declarative dynamic UI and adaptive data

Extends the Fabulous programming model to use adaptive data for high-performance updates in data-rich UIs.

Experimental, wet-paint, no nuget packages or templates yet. Originated from this discussion. See also corresponding work on Fable.Elmish.Adaptive.

With Fabulous Adaptive, you can write code like this:

type Model = { Text: string }

type Msg =
    | ButtonClicked

let init () =
    { Text = "Hello Fabulous!" }

let update msg model =
    match msg with
    | ButtonClicked -> { model with Text = "Thanks for using Fabulous!" }

// Write the view with resept to the adaptive vesion of the model.
let view (amodel: AdaptiveModel) dispatch =
    View.ContentPage(
        View.StackLayout(
            children = cs [
                View.Image(source = c (Path "fabulous.png"))
                View.Label(text = model.Text, fontSize = c (FontSize 22.0))
                View.Button(text = c "Click me", command = c (fun () -> dispatch ButtonClicked))
            ]
        )
    )

You must also add the following boiler-plate code - see also the 'Adaptify' tool.

/// An adaptive vesion of the model. 
type AdaptiveModel = { Text: cval<string> }

/// Initialize an adaptive vesion of the model.
let ainit (model: Model) = { Text = cval model.Text }

/// Update an adaptive vesion of the model. 
let adelta (model: Model) (amodel: AdaptiveModel) =
    transact (fun () -> 
        if model.Text <> amodel.Text.Value then 
            amodel.Text.Value <- model.Text
    )
You can’t perform that action at this time.