question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Spec] Slim Renderer Architecture

See original GitHub issue

WARNING: this spec is still a WIP, we’re still experimenting with this concept

Description

Slim renderers architecture benefits from multi-targetting and single-project features.

Example

EntryRenderer.cs

public partial class EntryRenderer {
   public static PropertyMapper<IView> ViewMapper = new PropertyMapper<IView> {
	
     // Add your own method to map to any property         
     [nameof(IView.BackgroundColor)] = MapBackgroundColor

   };
}

EntryRenderer.iOS.cs

// You don’t need to register a new renderer.
public partial class EntryRenderer
{
     // You know what method to call because you named it!
   public static void MapBackgroundColor (IViewRenderer renderer, IView view)
     {
        // You don’t need to call any base methods here or worry about order.
   
        // Every renderer is consistent; you know where the native view is.
          var nativeView = (NativeView)renderer.NativeView;
          var color = view.BackgroundColor;

          if (color != null) {

            // Phew! That was easy!	        
            nativeView.BackgroundColor = UIColor.FromRGB (204, 153, 255);
          }
     }
}

Standardization of renderers

All the default renderers will be ported to this architecture, for all platforms

Registration of renderers

The rendererRegistrar will exists on the dependency service and be accessed by serviceCollection.Get<IRendererRegistrar>(), allowing control to which renderer is associated to which control

Interfaces on renderers

Mapper concept

The property mapper is responsible for triggering actions in response property changes. A slim renderer itself does not subscribe to the property changes, but some declared actions are executed in response to changes.

The property mapper property of a control is public static and can be extended by user code.

The property mapper plays no role in the feedback loop (button clicked, text entered)

TODO: discuss what to use for mapper key. string or object ? It’d be nice to avoid string comparison in case when we can compare references (in case of BindableProperties)

How to use legacy custom renderers

How to use third-party controls depending on old renderers

How to complement existing renderers

The new extensibility model for this architecture is based on the property mapper. When you want to add support for a new property, it only requires mapping the new property. For the property to exists, subclassing the control is necessary, but subclassing the renderer is not.

Backward Compatibility

Wether we want to keep backward compatibility with existing custom renderers, or subclasses of old renderers will influence the architecture of this

Difficulty : very high

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:110
  • Comments:87 (32 by maintainers)

github_iconTop GitHub Comments

319reactions
MichaelRumplercommented, May 19, 2020

Please don’t try to stay backwards compatible at all costs. This is something new. It does not have to be compatible with XF. You can make something better.

183reactions
ugnivscommented, May 19, 2020

Why not to make UI framework with own set of controls without any kind of mappings and behavioral logic fully written on c# that would be rendered with Skia graphics library? As people use strongly customized design there is no need in trying to match platform design guidelines. The only need is possibility of flexible customizations. Please correct me if i’m missing something, but i don’t understand why benefit is over Renderer architecture.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet MAUI
WARNING: this spec is still a WIP, we're still experimenting with this concept Description Slim renderers architecture benefits from multi- ...
Read more >
Reuse custom renderers in .NET MAUI
Learn how to adapt Xamarin.Forms custom renderers to work in a .NET MAUI app.
Read more >
Hello! Welcome to Destiny's Multi-threaded Renderer ...
Today, I will cover the Destiny core renderer architecture, talk about how the engine data flows from game simulation through to the GPU, ......
Read more >
The best free rendering software for architects - YouTube
Scroll for resources mentioned. Written guide - https://uhstudio.com/posts/blender-best-free- rendering -software-for- architects .
Read more >
Internal rendering architecture - Godot Docs
This is a forward renderer that uses a clustered approach to lighting. Clustered lighting uses a compute shader to group lights into a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found