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

MacOS #650

Merged
merged 284 commits into from Jan 26, 2017

Conversation

Projects
None yet
8 participants
@rmarinho
Member

rmarinho commented Dec 15, 2016

Description of Change

This PR adds support for MacOS backend on Xamarin.Forms.

All the controls are implemented expect OpenGLView, but not all features are present.
We have UITest rudimentary support on CI.

Opening the PR to prepare for review and merge in the following weeks. As well as get general feedback.
Take in mind most renderers are ported from the iOS counterpart and might have some incongruences that we can now fix in this new implementation , please point them out if see them.

Xamarin.Forms.Maps.MacOS.Extra is a extra lib that is only needed to support Cycle 8, it has some missing APIS that were only added to Xamarin.Mac in Cycle9.

TODO:
Missing:
OpenGlRenderer
ListView - ScrollTo, Unevenrows, refreshing, Separator color and visibility, footer
ViewCell - is enable missing, onforce update size 
Image - Aspect
Picker - Bindable/ observable implementation
MasterDetailpage- Background color missing
tabbedPage - BarBackgroundColor and BarText Color
TableView - Unevenrows
WebView - Most WebNavigationEvents
Navigation - insert page before

In alpha, needing feedback, basicand modal navigation, UI and styling of controls, we welcome pr's 

Behavioral Changes

Add MacOS backend

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Consolidate commits as makes sense

rmarinho added some commits Aug 22, 2016

rmarinho and others added some commits Jan 23, 2017

[macOS] Fixed Tab NSImage crash in TabbedPageRenderer (#705)
* [macOS] Fixed Tab NSImage crash in TabbedPageRenderer

* Coding Style

* Coding Style
@@ -13,6 +13,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Maps.macOS")]

This comment has been minimized.

@samhouts
@samhouts
Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Cells/TextCellRenderer.cs
var textCell = (TextCell)tvc.Cell;
if (args.PropertyName == TextCell.TextProperty.PropertyName)
{
tvc.TextLabel.StringValue = ((TextCell)tvc.Cell).Text ?? "";

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Can't you use textCell here instead of casting again?

@samhouts

samhouts Jan 26, 2017

Member

Can't you use textCell here instead of casting again?

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Cells/TextCellRenderer.cs
}
else if (args.PropertyName == TextCell.DetailProperty.PropertyName)
{
tvc.DetailTextLabel.StringValue = ((TextCell)tvc.Cell).Detail ?? "";

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Can't you use textCell here instead of casting again?

@samhouts

samhouts Jan 26, 2017

Member

Can't you use textCell here instead of casting again?

internal NSViewController ViewController => PlatformRenderer;
internal static void DisposeModelAndChildrenRenderers(Element view)

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Modal?

@samhouts

samhouts Jan 26, 2017

Member

Modal?

This comment has been minimized.

@rmarinho

rmarinho Jan 26, 2017

Member

No it's really Model like yourself and children (this is the same on iOS)

@rmarinho

rmarinho Jan 26, 2017

Member

No it's really Model like yourself and children (this is the same on iOS)

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Platform.cs
if (rendererToRemove == null || rendererToRemove.Element == null)
return;
if (rendererToRemove.Element != null && GetRenderer(rendererToRemove.Element) == rendererToRemove)

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

We already null check rendererToRemove.Element just above this.

@samhouts

samhouts Jan 26, 2017

Member

We already null check rendererToRemove.Element just above this.

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Renderers/ListViewRenderer.cs
ITemplatedItemsView<Cell> TemplatedItemsView => Element;
public const int DefaultRowHeight = 44;

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

This says 16 is the default row height for macOS.

@samhouts

samhouts Jan 26, 2017

Member

This says 16 is the default row height for macOS.

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Renderers/PickerRenderer.cs
_disposed = true;
if (Element != null)
{
//((ObservableList<string>)Element.Items).CollectionChanged -= RowsCollectionChanged;

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Is this a todo?

@samhouts

samhouts Jan 26, 2017

Member

Is this a todo?

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Renderers/ProgressBarRenderer.cs
protected override void SetBackgroundColor(Color color)
{
//base.SetBackgroundColor(color);

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Is this a todo?

@samhouts

samhouts Jan 26, 2017

Member

Is this a todo?

Show outdated Hide outdated Xamarin.Forms.Platform.MacOS/Renderers/ScrollViewRenderer.cs
[Export(nameof(UpdateScrollPosition))]
void UpdateScrollPosition()
{
System.Diagnostics.Debug.WriteLine("need to fix this math");

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

Maybe this should be a todo instead of a debug writeline?

@samhouts

samhouts Jan 26, 2017

Member

Maybe this should be a todo instead of a debug writeline?

else
{
Control.StringValue = (string)values[1] ?? "";
// default value of color documented to be black in iOS docs

This comment has been minimized.

@samhouts

samhouts Jan 26, 2017

Member

What about mac docs? :)

@samhouts

samhouts Jan 26, 2017

Member

What about mac docs? :)

This comment has been minimized.

@rmarinho

rmarinho Jan 26, 2017

Member

Hum.. didn't found it.

@rmarinho

rmarinho Jan 26, 2017

Member

Hum.. didn't found it.

@samhouts

This comment has been minimized.

Show comment
Hide comment
@samhouts

samhouts Jan 26, 2017

Member

I'd recommend putting TODOs on all commented code to make it easier to find.

Member

samhouts commented Jan 26, 2017

I'd recommend putting TODOs on all commented code to make it easier to find.

@rmarinho rmarinho merged commit 52fc047 into master Jan 26, 2017

2 checks passed

OSX-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: OSX Debug : Running
Details
Windows-Debug-C8 Finished TeamCity Build Xamarin.Forms :: Debug :: Cycle 8 :: Windows Debug : Tests passed: 3713, ignored: 10
Details

knocte added a commit to knocte/Xamarin.Forms that referenced this pull request Apr 17, 2017

rmarinho added a commit that referenced this pull request Apr 18, 2017

@rmarinho

This comment has been minimized.

Show comment
Hide comment
@rmarinho

rmarinho Apr 19, 2017

Member

@samhouts you were so right and i forgot , but did it now :)

Member

rmarinho commented Apr 19, 2017

@samhouts you were so right and i forgot , but did it now :)

@samhouts samhouts added D-15.4 and removed cla-already-signed labels Oct 10, 2017

@samhouts samhouts modified the milestones: 2.3.0, 2.3.5 Jun 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment