Share via


Xamarin.Mac application fundamentals

Common patterns and idioms

Throughout the Apple APIs exposed via C#, certain idioms and patterns come up over and over again. If you have experience with programming with Xamarin.iOS, these may look familiar. Documentation will often refer to these patterns and idioms repeatedly, so having a solid understanding of them will help you make sense of the documentation you find.

Understanding Mac APIs

For much of your time developing with Xamarin.Mac, you can think, read, and write in C# without much concern with the underlying Objective-C APIs. However, sometimes you’ll need to read the API documentation from Apple, translate an answer from Stack Overflow to a solution for your problem, or compare to an existing sample.

Console apps

You can also build "headless" console apps that access native macOS APIs using Xamarin.Mac.

Working with .xib files

This article covers working with .xib files created in Xcode's Interface Builder to create and maintain user interfaces for a Xamarin.Mac application.

.storyboard/.xib less user interface design

This article covers creating a Xamarin.Mac application's user interface directly from C# code without using Xcode's Interface Builder with .storyboard or .xib files.

Working with images

This article covers working with images and icons in a Xamarin.Mac application. It covers creating and maintaining the images needed to create your application's icon and using images in both C# code and Xcode's Interface Builder.

Data binding and key-value coding

This article covers using key-value coding and key-value observing to allow for data binding to UI elements in Xcode's Interface Builder. Using this technique, you greatly reduce the amount of C# code that needs to be written for your Xamarin.Mac application.

Working with databases

This article covers using key-value coding and key-value observing to allow for data binding with direct access to SQLite databases to UI elements in Xcode's Interface Builder. It also covers using the SQLite.NET ORM to provide access to SQLite data.

Working with copy and paste

This article covers working with the pasteboard to provide copy and paste in a Xamarin.Mac application. It shows how to work with standard data types that can be shared between multiple apps and how to support custom data within a give app.

Sandboxing a Xamarin.Mac app

This article covers sandboxing a Xamarin.Mac application for release on the App Store. It covers all of the elements that go into sandboxing: container directories, entitlements, user-determined permissions, privilege separation, and kernel enforcement.

Playing sound with AVAudioPlayer

This article shows how to use a helper class to control the playback of sound using an AVAudioPlayer.

Reporting bugs

Sometimes we all get stuck while working on a project, either on the inability to get an API to work the way we want or in trying to work around a bug. Our goal at Xamarin is for you to be successful in writing your mobile and desktop applications, and we’ve provided some resources to help.