[forms-devel] Xamarin forms on the MAC - It's working!

Rui Marinho rumar at microsoft.com
Sun Sep 4 02:27:25 UTC 2016


Hi everyone, I have great news to share, we have made some good progress in the MacOS backend for Xamarin Forms.
The idea comes from making xamarin forms available in more forms factors and we arrive now at the desktop, and for now in the Mac.

In the last 3 weeks I worked on a branch MacOS<https://github.com/xamarin/Xamarin.Forms/tree/macOS> in our public repo where I laid the bases for this. There was some previous work from Miguel that also worked as inspiration. Most of the basic controls are working, that said, when I say working I refer they are rendering on the screen,  and do what they are supposed, some of extra features and styling are missing, I ended up taking most of the time trying to find ways  to change colors, backgrounds  or tweak on stuff, that implementing behaviors, so this last week I shifted to get most of all the heavy work done.

This is a great time to put this out there and ask for feedback in this early stages, we need feedback on the current state and the implementations we are chosing for our controls. There‘s also some need for people to help us test as this is in early stages and our team is also focus in other subjects.

Most of the controls were easy to choose, others were personal choice, of course most of the implementation follow the iOS backend but not everything exists in the Mac api, for example there’s no  UINavigationController .. there’s something similar like NSPageController.

Starting with basic, the layout, the Mac has a singularity that’s the coordinate system is based on bottom left (0,0) and not in top left like in iOS. So we need to take that in account in places like the VisualElementTracker when setting the frame of our control, I just made a small change to allow this, and I m sure this might not fit all solutions so we will need to revise that. Also all element transformations are not yet implemented, just basic position and sizing.

ListView needs a lot of more work for implement all features, specially grouping, for now just simple list with all types of cells. Apple recommends that on the Mac you use NSView instead of old NSCell types, so I ended up implementing  a basic NSView that mimics the iOS default cells, so that makes it able to render ImageCell, TextCell, EntryCell and SwitchCell. Also there’s VIewCell support but with some issues when scrolling that need to be fixed. Cell reuse is implemented

In the pages, most particular one is NavigationPage, Mac has the NSPageController, but this works good when you know how many items you have (CarouselPage) I didn’t get it to work ok after spending a couple hours in the History mode, so I ended up implemented a custom control that just pushes/pops  views without animations yet. I also added a toolbar that sits on top attached to the window that will show the back button and the tittle bar. This is a big place where we need feedback and discussion on the best implementation and design. CarouselPage was implemented using a NSScrollView but I’m changing to use NSPagecontroller. MasterDetailPage is just a NSSplitView, there’s no other feature implemented yet.

For now there’s also no extra features like gestures, toolbaritems support yet, modal windows, actions sheets and alerts… I have looked at all of these they seem to have similar ways to be implemented on the Mac.

You can find a particular page on our ControlGallery<https://github.com/xamarin/Xamarin.Forms/blob/macOS/Xamarin.Forms.Controls/GalleryPages/MacOSTestGallery.cs> with all the controls  and pages to test on the Mac, a basic showoff of what’s done.

I also want to finish this by sharing what I did in a couple of hours and that I m working to replicate and show Xamarin Forms on the Mac,  drum rol….. a TWITTER app rip off ☺
It’s not fully interactive but you can see most of layout and controls are there and shows that with XF toolkit on the Mac is possible to write great apps. And you just need this XAML<https://github.com/xamarin/Xamarin.Forms/blob/macOS/Xamarin.Forms.Controls/MacTwitterDemo.xaml>, and some noun icons ☺

[cid:image001.png at 01D2065C.6FEF7E50]

I hope you guys take the time to experience and play with Xamarin Forms in the Mac as well as give us feedback and ideas to go forward.

Bellow you can find comments for each  individual control:

ActivityIndicator - Done
BoxView -Done
Button- Missing ImageInsets, Image ContentMode
DatePicker - Done
Editor- Done
Entry - Done
Frame - Done
Image – Missing clip bounds, no ContentMode
Label - Done
OpenGL- just mockup
Picker - Done
Progress— doesn’t update progress
ScrollView = Needs fix ScrollTo coordinates inversion
Search - missing cancel button color and background color
Slider - Done
Stepper -Done
Switch - Done
TimePicker – Done
Webview - Missing some navigation events
List view - no grouping . no refresh, no footer, no separator, header needs background, no item changes, just simple listing for now , scrolling view cell is bad, deselect row, ScrollTo, Unselect

Cells – missing background and update size, invert color on selected. recycle, template selector, context actions

CarouselPage - Done but i will change this to be NSPageController, that supports better animations and is perfect for the scenario where we know how many pages we have.
TabPage - missing colours text and tab background  (Still figuring what the right tab style)
NavigationPage - NoAnimations, needs testing, performance, no Toolbaritems, no pop to root, tried NSPageController
MasterDetailPage - Just split no IsPresented implementation, no implementation os different behaviours, reuse and change detail page not implemented yet too.

Layout - Missing layer transformations, and hidden layer when no size (had some problems with that)

Thanks

Best Regards

Rui Marinho
Xamarin Forms TEam



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/forms-devel/attachments/20160904/913d24bb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 347080 bytes
Desc: image001.png
URL: <http://lists.dot.net/pipermail/forms-devel/attachments/20160904/913d24bb/attachment-0001.png>


More information about the forms-devel mailing list