Preview: Xamarin.Forms for macOS

DavidOrtinauDavidOrtinau David OrtinauUSXamarin Team, Insider, University Xamurai

I hope you are taking an opportunity with the latest pre-release 2.3.5.233-pre1 to experience your Xamarin.Forms apps running on macOS. It's a trip.

We want to kick off a thread to have some ongoing discussion about what's missing, what's not working, and where you'd like to see this go.

Please keep the discussion here on topic: macOS.

Posts

  • SjoerdvanNoortSjoerdvanNoort Sjoerd van Noort NLBeta ✭✭
    edited April 21

    I've started experimenting. It seems to work functionally pretty well. But is looks very ugly.

    Text looks fuzzy.

    Also VerticalTextAlignment="Center" does not seem to work (works/looks fine on iOS):

    <TableView Intent="Settings">
        <TableRoot>
            <TableSection Title="section1">
                <ViewCell >
                        <StackLayout Margin="15,0,15,0" Orientation="Horizontal">
                        <Label Text="Default" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" />
                        <Label TextColor="Gray" x:Name="G1" Text="-"  HorizontalOptions="End" VerticalTextAlignment="Center" />
                        <Label TextColor="Gray" FontAttributes="Bold" Text="-"  HorizontalOptions="End" VerticalTextAlignment="Center" />
                    </StackLayout>
                </ViewCell>
            </TableSection>
        </TableRoot>
    </TableView>
    

    But on mac the labels are top aligned

  • HalilDoganBolakHalilDoganBolak Halil Dogan Bolak USMember
    edited April 22

    @DavidOrtinau - First of all, thank you and the Xamarin.Forms team very much for this. Many development teams around the world were eagerly waiting for Xamarin.Forms on Mac. Yes we all have seen the release discussion thread but the amount of information & guidance there was very little. Is there a small walk through or guideline on how to add the MAC OS to an existing Visual Studio 2015 multi-platform project ? For example, I got one that is currently implemented for iOS/Droid/UWP.

  • dave.9411dave.9411 david bagno USMember
    edited April 22


    This is an amazing accomplishment. I am a long time OS X developer and have been dreaming about this for years. I hope this effort will get Xamarin's full backing and will reach the maturity of the other platforms. I have been playing with it since last night and it is very easy to implement. It seems too good to be true. I only hope that in the future it will be part of the Xamarin.Forms project template. I also hope OS X projects will be part of the Xaml previewer.

  • dave.9411dave.9411 david bagno USMember

    Any ideas how to get text to speech working on OS X in a dependency service? Can't find AVSpeechSynthesizer()

    using System;
    using AVFoundation;
    using AVKit;

    using Foundation;
    using WordGames.OSX;

    [assembly: Xamarin.Forms.Dependency(typeof(TextToSpeech_OSX))]
    namespace WordGames.OSX
    {
    public class TextToSpeech_OSX : ITextToSpeech
    {
    public TextToSpeech_OSX()
    {
    }

        public void Speak(string text)
        {
    
            var speechSynthesizer = new AVSpeechSynthesizer();
    
            var speechUtterance = new AVSpeechUtterance(text)
            {
                Rate = AVSpeechUtterance.MaximumSpeechRate / 4,
                Voice = AVSpeechSynthesisVoice.FromLanguage("en-US"),
                Volume = 0.5f,
                PitchMultiplier = 1.0f
            };
    
            speechSynthesizer.SpeakUtterance(speechUtterance);
        }
    }
    

    }

  • MichaelZaletelMichaelZaletel Michael Zaletel USUniversity
    edited April 28

    A few tips for anyone trying to follow the blog tutorial here:
    https://blog.xamarin.com/preview-bringing-macos-to-xamarin-forms/

    1. Make sure that you right click on the References folder in the Mac project, choose Edit References and switch to the Projects Tab and check the box next to the Xamarin Forms Shared Project. (see attached)
    2. I am getting an error in the Mac project References folder on Xamarin.Mac (See attached) but it still seems to work
    3. Make sure to add the following using directives to AppDelegate.cs in the MacOS project
      using Xamarin.Forms;
      using Xamarin.Forms.Platform.MacOS;

    Michael Zaletel
    Enterprise Mobility @ Productive Edge
    Xamarin MVP
    Xamarin Elite Partner

Sign In or Register to comment.