Convert Figma logo to code with AI

dotnet logomacios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#

2,646
536
2,646
689

Top Related Projects

2,644

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#

11,265

Mono open source ECMA CLI, C# and .NET implementation.

A framework for building native macOS apps with React.

A framework for building native Windows apps with React.

117,268

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

Quick Overview

The dotnet/macios repository is a part of the .NET ecosystem, providing bindings and tools for developing iOS, macOS, tvOS, and watchOS applications using C# and .NET. It enables developers to create native Apple platform applications using familiar .NET technologies and tools.

Pros

  • Allows developers to use C# and .NET for Apple platform development
  • Provides access to native iOS and macOS APIs through .NET bindings
  • Integrates with existing .NET tools and workflows
  • Supports cross-platform development with Xamarin.Forms and .NET MAUI

Cons

  • May have performance overhead compared to native Objective-C or Swift development
  • Requires keeping up with both .NET and Apple platform updates
  • Limited community support compared to native iOS/macOS development
  • Some advanced or newer Apple APIs may have delayed support

Code Examples

  1. Creating a simple iOS button:
using UIKit;

var button = new UIButton(UIButtonType.System);
button.SetTitle("Click me", UIControlState.Normal);
button.Frame = new CGRect(50, 50, 200, 50);
button.TouchUpInside += (sender, e) => {
    Console.WriteLine("Button clicked!");
};
View.AddSubview(button);
  1. Accessing device information:
using Foundation;

var device = UIDevice.CurrentDevice;
Console.WriteLine($"Device Name: {device.Name}");
Console.WriteLine($"System Version: {device.SystemVersion}");
Console.WriteLine($"Model: {device.Model}");
  1. Making an HTTP request:
using System.Net.Http;

var client = new HttpClient();
var response = await client.GetAsync("https://api.example.com/data");
var content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);

Getting Started

  1. Install Visual Studio for Mac or Visual Studio with .NET MAUI workload.
  2. Create a new .NET MAUI or Xamarin.iOS project.
  3. Add the following NuGet packages:
    dotnet add package Xamarin.iOS
    dotnet add package Xamarin.Essentials
    
  4. Start coding your iOS/macOS application using C# and .NET APIs.

For more detailed instructions, refer to the official documentation at https://docs.microsoft.com/xamarin/ios/get-started/

Competitor Comparisons

2,644

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#

Pros of macios

  • Unified codebase for iOS and macOS development
  • Seamless integration with .NET ecosystem
  • Extensive documentation and community support

Cons of macios

  • Potentially larger binary sizes
  • Slightly slower performance compared to native development
  • Learning curve for developers new to .NET

Code Comparison

macios:

using UIKit;

public class AppDelegate : UIApplicationDelegate
{
    public override UIWindow Window { get; set; }
}

macios:

using UIKit;

public class AppDelegate : UIApplicationDelegate
{
    public override UIWindow Window { get; set; }
}

Summary

Both macios repositories appear to be identical, as they are likely the same project. The comparison provided above is based on the general characteristics of the macios project compared to native iOS and macOS development. The macios repository offers a unified approach to iOS and macOS development using .NET, which can be beneficial for developers familiar with the ecosystem. However, it may have some trade-offs in terms of performance and binary size compared to native development. The code example provided is the same for both repositories, demonstrating a basic AppDelegate class for iOS development using macios.

11,265

Mono open source ECMA CLI, C# and .NET implementation.

Pros of mono

  • Broader platform support, including Linux and various Unix-like systems
  • Longer history and more established ecosystem
  • More comprehensive implementation of .NET Framework APIs

Cons of mono

  • Slower release cycle compared to macios
  • Less focus on modern .NET Core and .NET 5+ features
  • May have more legacy code and technical debt

Code comparison

mono:

public class MyClass : IDisposable
{
    public void Dispose()
    {
        // Cleanup code
    }
}

macios:

public class MyClass : IDisposable
{
    public void Dispose()
    {
        // Cleanup code
    }
}

The basic code structure remains similar between the two projects, as they both implement .NET standards. However, macios may include more iOS and macOS-specific APIs and features in its implementation.

Additional notes

  • mono is a more general-purpose .NET implementation, while macios is specifically tailored for iOS and macOS development
  • macios is more closely aligned with Microsoft's official .NET release cycle and roadmap
  • Both projects contribute to the broader .NET ecosystem, but with different focuses and target platforms

A framework for building native macOS apps with React.

Pros of react-native-macos

  • Cross-platform development: Build macOS apps using React Native, enabling code sharing with iOS and Android
  • Faster development cycles: Leverage hot reloading and instant updates for quicker iterations
  • Large ecosystem: Access to a vast library of React Native components and third-party packages

Cons of react-native-macos

  • Performance limitations: Native macOS apps may offer better performance for complex applications
  • Limited access to macOS-specific features: Some advanced macOS functionalities might be challenging to implement
  • Learning curve: Developers need to understand both React Native and macOS-specific concepts

Code Comparison

react-native-macos:

import React from 'react';
import { AppRegistry, StyleSheet, Text, View } from 'react-native';

const App = () => (
  <View style={styles.container}>
    <Text style={styles.text}>Hello, macOS!</Text>
  </View>
);

macios:

using AppKit;

namespace MyMacApp
{
    public class AppDelegate : NSApplicationDelegate
    {
        public override void DidFinishLaunching(NSNotification notification)
        {
            var label = new NSTextField { StringValue = "Hello, macOS!" };
        }
    }
}

A framework for building native Windows apps with React.

Pros of react-native-windows

  • Enables cross-platform development for Windows using React Native
  • Larger community and more extensive documentation
  • More frequent updates and active development

Cons of react-native-windows

  • Limited to Windows platform, while macios supports both macOS and iOS
  • Steeper learning curve for developers not familiar with React Native
  • May have performance limitations compared to native development

Code Comparison

react-native-windows:

import React from 'react';
import { View, Text } from 'react-native';

const App = () => (
  <View>
    <Text>Hello, Windows!</Text>
  </View>
);

macios:

using UIKit;

public class ViewController : UIViewController
{
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();
        var label = new UILabel(View.Frame) { Text = "Hello, iOS!" };
        View.AddSubview(label);
    }
}

The code examples demonstrate the different approaches to creating a simple UI element. react-native-windows uses JSX syntax and React components, while macios uses native iOS UI elements with C# syntax.

Both repositories aim to simplify cross-platform development, but for different target platforms. react-native-windows focuses on bringing React Native to Windows, while macios provides a unified API for developing macOS and iOS applications using .NET.

117,268

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Pros of Electron

  • Cross-platform development for desktop applications using web technologies
  • Large ecosystem and community support
  • Easier learning curve for web developers

Cons of Electron

  • Higher memory usage and larger application size
  • Performance limitations compared to native applications
  • Security concerns due to Chromium's attack surface

Code Comparison

Electron (JavaScript):

const { app, BrowserWindow } = require('electron')

function createWindow () {
  const win = new BrowserWindow({ width: 800, height: 600 })
  win.loadFile('index.html')
}

app.whenReady().then(createWindow)

macios (C#):

using UIKit;

public class AppDelegate : UIApplicationDelegate
{
    public override UIWindow Window { get; set; }

    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        Window = new UIWindow(UIScreen.MainScreen.Bounds);
        Window.RootViewController = new UIViewController();
        Window.MakeKeyAndVisible();
        return true;
    }
}

The code snippets demonstrate the basic setup for creating a window in both frameworks. Electron uses JavaScript and web technologies, while macios uses C# and native iOS components.

⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.

Pros of NativeScript

  • Cross-platform development for iOS and Android from a single codebase
  • Uses JavaScript or TypeScript, allowing web developers to easily transition
  • Extensive plugin ecosystem for adding native functionality

Cons of NativeScript

  • Steeper learning curve for developers new to mobile development
  • Performance may not match fully native apps in complex scenarios
  • Limited access to platform-specific APIs compared to native development

Code Comparison

NativeScript (JavaScript):

import { Application } from "@nativescript/core";
Application.run({ moduleName: "app-root" });

macios (C#):

using UIKit;

public class AppDelegate : UIApplicationDelegate
{
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        return true;
    }
}

Key Differences

  • NativeScript focuses on cross-platform development, while macios is specific to iOS and macOS
  • macios provides direct access to native APIs, while NativeScript abstracts them
  • NativeScript uses JavaScript/TypeScript, whereas macios uses C# and .NET
  • macios offers tighter integration with Apple's ecosystem and tooling
  • NativeScript has a larger community and more third-party plugins available

Both frameworks have their strengths, with NativeScript excelling in cross-platform development and macios providing deeper integration with Apple platforms. The choice between them depends on the specific project requirements and developer expertise.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

.NET for iOS, Mac Catalyst, macOS, tvOS

Welcome!

This module is the main repository for:

  • .NET for iOS
  • .NET for Mac Catalyst
  • .NET for macOS
  • .NET for tvOS

These SDKs allow us to create native iOS, Mac Catalyst, macOS and tvOS applications using the same UI controls we would in Objective-C and Xcode, except with the flexibility and elegance of a modern language (C#), the power of the .NET Base Class Library (BCL), and first-class IDEs and editors—Visual Studio and Visual Studio Code—at our fingertips.

This repository is where we do development for the .NET for iOS, Mac Catalyst, macOS, and tvOS SDKs. .NET for iOS, Mac Catalyst, macOS, and tvOS are part of .NET MAUI, and may also be used independently for native iOS and macOS development with .NET.

There are a few ways that you can contribute, for example:

Support

.NET for iOS, Mac Catalyst, macOS, and tvOS are part of .NET MAUI, since it was introduced in May 2022 as part of .NET 6, and is currently supported as described on the .NET MAUI Support Policy.

Support for Xamarin.iOS and Xamarin.Mac ended on May 1, 2024 as per the Xamarin Support Policy:

Xamarin support ended on May 1, 2024 for all Xamarin SDKs including Xamarin.Forms. Android API 34 and Xcode 15 SDKs (iOS and iPadOS 17, macOS 14) are the final versions Xamarin targets from existing Xamarin SDKs (i.e. no new APIs are planned).

Contributing

If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following:

Downloads

The preferred method for installing Xamarin.iOS and Mac is to use the Visual Studio installers (Windows, Mac).

The team also strongly recommends using the latest Xamarin SDK and Xcode whenever possible.

However, we provide links to older Xamarin.iOS and Mac packages for macOS downgrades and build machine configuration, see Downloads.

Feedback

Discord

License

Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.