xamarin-macios/src
Alex Soto d8ace2658e [Contacts] Fix wrong delegate signature on CNContactStoreEnumerateContactsHandler (#22)
From PR https://github.com/xamarin/xamarin-macios/pull/19

The signature on  `CNContactStoreEnumerateContactsHandler` should
include a `ref`on the `bool stop` parameter in order to have the
ability to early exit the enumeration.

Ref: http://stackoverflow.com/questions/36992982/early-exit-a-cncontactstoreenumeratecontactshandler-enumeration
2016-05-03 12:03:41 -04:00
..
AVFoundation Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AVKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Accelerate Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Accounts Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AddressBook Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AddressBookUI Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AppKit [appkit] Add NSImage lazy initialization 2016-04-27 11:07:48 -04:00
AssetsLibrary Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AudioToolbox Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AudioUnit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CFNetwork Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Carbon Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ClockKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CloudKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Contacts Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreAnimation Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreBluetooth Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreData Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreFoundation Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreGraphics Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreImage Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreLocation Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreMedia Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreMidi Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreMotion Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreServices Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreSpotlight Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreTelephony Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreText Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreVideo Build the platform assemblies. 2016-04-24 14:47:26 -04:00
CoreWlan Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Darwin Build the platform assemblies. 2016-04-24 14:47:26 -04:00
EventKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
EventKitUI Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ExternalAccessory Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Foundation [Foundation] Add null check for Observer cback (#7) 2016-04-28 14:19:45 -04:00
GLKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
GameController Build the platform assemblies. 2016-04-24 14:47:26 -04:00
GameKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
GameplayKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
HealthKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
HomeKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ImageIO Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ImageKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
InputMethodKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
JavaScriptCore Build the platform assemblies. 2016-04-24 14:47:26 -04:00
LocalAuthentication Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MapKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MediaAccessibility Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MediaLibrary Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MediaPlayer Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MediaToolbox Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MessageUI Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Metal Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MetalKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MetalPerformanceShaders Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MobileCoreServices Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ModelIO Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MultipeerConnectivity Build the platform assemblies. 2016-04-24 14:47:26 -04:00
NativeTypes Build the platform assemblies. 2016-04-24 14:47:26 -04:00
NetworkExtension Build the platform assemblies. 2016-04-24 14:47:26 -04:00
NewsstandKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
NotificationCenter Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ObjCRuntime [mmp/mtouch] Don't mkbundle anymore. 2016-04-25 18:14:56 -04:00
OpenGL Build the platform assemblies. 2016-04-24 14:47:26 -04:00
OpenGLES Build the platform assemblies. 2016-04-24 14:47:26 -04:00
PassKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
PdfKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Photos Build the platform assemblies. 2016-04-24 14:47:26 -04:00
PhotosUI Build the platform assemblies. 2016-04-24 14:47:26 -04:00
QTKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
QuickLook Build the platform assemblies. 2016-04-24 14:47:26 -04:00
QuickLookUI Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ReplayKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
SafariServices Build the platform assemblies. 2016-04-24 14:47:26 -04:00
SceneKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
ScriptingBridge Build the platform assemblies. 2016-04-24 14:47:26 -04:00
SearchKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Security Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Social Build the platform assemblies. 2016-04-24 14:47:26 -04:00
SpriteKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
StoreKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
System.ComponentModel Build the platform assemblies. 2016-04-24 14:47:26 -04:00
SystemConfiguration Build the platform assemblies. 2016-04-24 14:47:26 -04:00
TVServices Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Twitter Build the platform assemblies. 2016-04-24 14:47:26 -04:00
UIKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
VideoToolbox Build the platform assemblies. 2016-04-24 14:47:26 -04:00
WKWebKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
WatchConnectivity Build the platform assemblies. 2016-04-24 14:47:26 -04:00
WatchKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
WebKit Build the platform assemblies. 2016-04-24 14:47:26 -04:00
iAd Build the platform assemblies. 2016-04-24 14:47:26 -04:00
.gitignore Build the platform assemblies. 2016-04-24 14:47:26 -04:00
AssemblyInfo.cs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Compat.iOS.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Compat.mac.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Constants.iOS.cs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Constants.mac.cs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Constants.tvos.cs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Constants.watch.cs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Makefile Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Makefile.generator Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoNativeFunctionWrapperAttribute.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoPInvokeCallbackAttribute.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.Dialog-1.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.Dialog-1.tvos.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.Dialog-1.unified.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.NUnitLite.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.NUnitLite.tvos.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.NUnitLite.unified.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
MonoTouch.NUnitLite.watchos.templ.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
Obsoletes.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
OpenTK.dll.sources Build the platform assemblies. 2016-04-24 14:47:26 -04:00
README.md Add some documentation to src/README. 2016-04-24 15:35:53 -04:00
Version.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
accelerate.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
accounts.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
addressbook.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
addressbookui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
adsupport.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
appkit.cs [appkit] Add NSImage lazy initialization 2016-04-27 11:07:48 -04:00
assetslibrary.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
audiotoolbox.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
audiounit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
avfoundation.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
avkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
bmac Build the platform assemblies. 2016-04-24 14:47:26 -04:00
bmac.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
btouch-native.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
btouch.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
btouch.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
btouch.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
bwatch.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
cfnetwork.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
clockkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
cloudkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
contacts.cs [Contacts] Fix wrong delegate signature on CNContactStoreEnumerateContactsHandler (#22) 2016-05-03 12:03:41 -04:00
contactsui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
contactsui.mac.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coreanimation.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coreaudiokit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corebluetooth.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coredata.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corefoundation.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coregraphics.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coreimage.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corelocation.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coremedia.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coremidi.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coremotion.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coreservices.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corespotlight.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coretelephony.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
coretext.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corevideo.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
corewlan.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
custom-make.sh Build the platform assemblies. 2016-04-24 14:47:26 -04:00
error.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
eventkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
eventkitui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
externalaccessory.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
foundation.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
frameworks.sources Build the platform assemblies. 2016-04-24 14:47:26 -04:00
gamecontroller.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
gamekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
gameplaykit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
generator-enums.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
generator-filters.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
generator.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
generator.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
generator.sln Build the platform assemblies. 2016-04-24 14:47:26 -04:00
glkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
global.css Build the platform assemblies. 2016-04-24 14:47:26 -04:00
healthkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
healthkitui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
homekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
iad.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
imageio.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
imagekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
inputmethodkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
javascriptcore.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
localauthentication.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
mapkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
mediaaccessibility.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
medialibrary.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
mediaplayer.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
mediatoolbox.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
messageui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
metal.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
metalkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
metalperformanceshaders.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
mobilecoreservices.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
modelio.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
monotouch-dialog.sources Build the platform assemblies. 2016-04-24 14:47:26 -04:00
multipeerconnectivity.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
networkextension.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
newsstandkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
notificationcenter.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
opengl.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
opengles.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
opentk.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
passkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
pdfkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
photos.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
photosui.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
pmcs.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
pushkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
qtkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
quartzcomposer.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
quicklook.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
quicklookUI.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
replaykit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
rosetta.pl Build the platform assemblies. 2016-04-24 14:47:26 -04:00
safariservices.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
scenekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
scriptingbridge.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
searchkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
security.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
social.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
spritekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
storekit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
system-drawing.sources Build the platform assemblies. 2016-04-24 14:47:26 -04:00
systemconfiguration.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
touch-unit.sources Build the platform assemblies. 2016-04-24 14:47:26 -04:00
tvmlkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
tvservices.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
twitter.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
uikit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
videotoolbox.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
watchconnectivity.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
watchkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
webkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
wkwebkit.cs Build the platform assemblies. 2016-04-24 14:47:26 -04:00
xamios.tmpl.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
xammac.pc.in Build the platform assemblies. 2016-04-24 14:47:26 -04:00
xammac.tmpl.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
xamtvos.tmpl.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00
xamwatch.tmpl.csproj Build the platform assemblies. 2016-04-24 14:47:26 -04:00

README.md

Platform assemblies

This directory contains the source code and build logic to build the platform assemblies.

Conditional compilation

These are the symbols defined for each platform assembly:

Assembly Symbols
monotouch.dll IPHONE MONOTOUCH IOS
Xamarin.iOS.dll IPHONE MONOTOUCH IOS XAMCORE_2_0
XamMac.dll MONOMAC XAMARIN_MAC
Xamarin.Mac.dll MONOMAC XAMARIN_MAC XAMCORE_2_0
Xamarin.WatchOS.dll IPHONE MONOTOUCH WATCH XAMCORE_2_0 XAMCORE_3_0
Xamarin.TVOS.dll IPHONE MONOTOUCH TVOS XAMCORE_2_0 XAMCORE_3_0

To build core for only one platform, use the platform unique variables IOS, MONOMAC, WATCH or TVOS.

Core Assemblies

Currently 3 variations of the core Xamarin.iOS assembly and 5 variations of the core Xamarin.Mac assembly are produced:

### Xamarin.iOS ###

  • A 32-bit Classic assembly (uses System.Int32 in place of NSInteger, etc.)
  • A 32-bit Unified assembly (uses System.nint in place of NSInteger, etc.)
  • A 64-bit Unified assembly (same as 32-bit Unified)

### Xamarin.Mac ###

  • A 32-bit Classic assembly (uses System.Int32 in place of NSInteger, etc.)
  • A 32-bit Unified assembly (uses System.nint in place of NSInteger, etc.)
  • A 64-bit Unified assembly (same as 32-bit Unified)
  • A 32-bit Full assembly (uses System.nint in place of NSInteger, and references the v4.5 BCL)
  • A 64-bit Full assembly (same as 32-bit Full)

The Classic assembly will exist in order to not break customer code. Customers can choose to continue using this assembly, but we will encourage customers to move to our Unified assemblies.

The Unified assemblies provides many improvements and support for 64-bit iOS and OS X APIs.

Native Types

Most native APIs use NSInteger (and related) typedefs. On 32-bit systems, these are 32-bit underlying types; on 64-bit systems, these are 64-bit underlying types.

Historically Xamarin.iOS and Xamarin.Mac have bound these explicitly as 32-bit (System.Int32, etc). With the move to 64-bit that has been ongoing in OS X for a few versions (10.6/Snow Leopard) and more recently with the anouncement of 64-bit support in iOS, we needed a solution to support both worlds.

We have introduced 6 new types to make this possible:

Native Type Legacy (32-bit) CIL Type New (32/64-bit) CIL Type
NSInteger System.Int32 System.nint
NSUInteger System.UInt32 System.nuint
CGFloat System.Single System.nfloat
CGSize System.Drawing.SizeF CoreGraphics.CGSize
CGPoint System.Drawing.PointF CoreGraphics.CGPoint
CGRect System.Drawing.RectangleF CoreGraphics.CGRect

In the Classic assembly, the System.Drawing types are backed by the 32-bit System.Single type. In the Unified assemblies, the CoreGraphics types are backed by 32/64-bit System.nfloat type.

When binding APIs, it is important to use the new types (nint, CGRect, etc), even though they do not exist in the Classic assembly.

Before compilation, all source code is preprocessed by pmcs, an internal tool for performing C#-aware preprocessing.

For the Classic assembly, instances of the new types are translated to the legacy types. For the Unified assemblies, these types are not translated, and the native types are included in the build.

Enums

Enums are handled specially. Most native enums are backed by NSInteger or NSUInteger. Unfortunately in C#, the backing type of an enum may only be one of the primitive integral C# types. Thus, an enum cannot be backed by System.nint or System.nuint.

The convention is to make all enums that are backed natively by NSInteger or NSUInteger backed by a 64-bit primitive integral C# type (long or ulong) and then annotated with the [Native] attribute. This ensures that API is identical between the 32/64-bit assemblies but also hints to the code generator that Objective-C runtime calls should first cast the enum to a System.nint or System.nuint.

However, this also presents a problem of keeping the enum 32-bit on the Classic assemblies. Therefore, enums should actually be backed in source code nuint_compat_int. This will be preprocessed to int on the Classic assembly and ulong on the 32/64-bit assemblies.

Native Enum Definition

typedef NS_ENUM(NSUInteger, NSTableViewDropOperation) {
	NSTableViewDropOn,
	NSTableViewDropAbove
};

Managed Enum Definition

[Native]
public enum NSTableViewDropOperation : nuint_compat_int {
	DropOn,
	DropAbove
}

When dealing with enums in P/Invokes, one must never pass such an enum directly. The P/Invoke signature should take a System.nint or System.nuint and a wrapper API must cast the enum manually (as mentioned above, this is handled automatically for Objective-C APIs by the generator).

Objective-C Binding

public interface Fooable {
	[Export ("foo:")]
	void Foo (NSTableViewDropOperation dropOp);
}

C Binding

public partial class Fooable {
	[DllImport ("foo")]
	static extern void Foo (nuint dropOp);

	public static void Foo (NSTableViewDropOperation dropOp)
	{
		Foo ((nuint)(ulong)dropOp);
	}
}

pmcs

pmcs is a wrapper around a regular mcs invocation. In addition to any regular arguments passed to mcs, pmcs accepts instructions on how to translate some tokens from one value to another. This is used to translate instances of native types in source code to legacy types for the 32-bit Classic assembly.

pmcs lives in the xamarin-macios repository and is used for both Xamarin.Mac and Xamarin.iOS. Explore pmcs documentation.

#define

There are a few preprocessor variables that can be used within sources for conditional compilation:

Variable Description
MONOMAC defined for Xamarin.Mac builds; not defined for Xamarin.iOS
ARCH_32 defined when the target architecture is 32-bit; this will be defined for Classic and the Unified 32-bit assemblies
ARCH_64 defined when the target architecture is 64-bit; this will be defined only for the Unified 64-bit assembly
XAMCORE_2_0 defined for the Unified assemblies; this should be used for most conditions dealing with API differences between Unified and Classic assemblies
COREBUILD defined when building the intermediate core.dll assembly against which the code generator will produce bindings

For example, to build an API for all of iOS but only 64-bit OS X (Xamarin.Mac):

#if !MONOMAC || (MONOMAC && ARCH_64)
...
#endif