This introduces a C# source generator to bring a couple improvements:
The Body property can be declared simply as View instead of the exact derived view type that it returns.
An overload may have an Action parameter marked with the [ViewBuilder] attribute. Inside the Body property, the lambda argument will be transformed using the same transformation the Swift compiler uses. This will enable a natural syntax for container views.
There is also an accompanying analyzer to enforce a couple policies:
Custom views must declare a Body property
Custom views must be declared partial (this is required for the aforementioned source generator to work)
This also adds a NuGet dependency to automatically use a new enough build of the Roslyn compiler to enable the source generator in currently shipping Xamarin.iOS and Xamarin.Mac projects. However, if the system mono doesn't also contain a new enough build of Roslyn, the code fixes for the above analyses won't be available in VS Mac.
This introduces a C# source generator to bring a couple improvements:
Body
property can be declared simply asView
instead of the exact derived view type that it returns.Action
parameter marked with the[ViewBuilder]
attribute. Inside theBody
property, the lambda argument will be transformed using the same transformation the Swift compiler uses. This will enable a natural syntax for container views.There is also an accompanying analyzer to enforce a couple policies:
Body
propertypartial
(this is required for the aforementioned source generator to work)This also adds a NuGet dependency to automatically use a new enough build of the Roslyn compiler to enable the source generator in currently shipping Xamarin.iOS and Xamarin.Mac projects. However, if the system mono doesn't also contain a new enough build of Roslyn, the code fixes for the above analyses won't be available in VS Mac.
Still TODO: