Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement .NET Swift interop support targeting Apple platforms #95638

Open
3 tasks
kotlarmilos opened this issue Dec 5, 2023 · 7 comments
Open
3 tasks

Implement .NET Swift interop support targeting Apple platforms #95638

kotlarmilos opened this issue Dec 5, 2023 · 7 comments
Assignees
Labels
area-Meta Epic Groups multiple user stories. Can be grouped under a theme. os-ios Apple iOS os-mac-os-x macOS aka OSX tracking This issue is tracking the completion of other related issues.
Milestone

Comments

@kotlarmilos
Copy link
Member

kotlarmilos commented Dec 5, 2023

Overview

The Swift programming language has a different ABI, runtime environment, and object model, making it challenging to call into from the .NET runtime. The goal is to establish .NET Interop support in the ecosystem and address Swift ABI differences. Apple's shift towards Swift highlights the importance of Maui being compatible with Swift libraries and frameworks to remain relevant in the Apple ecosystem. Ideally, the interop should operate with a minimal set of additional wrappers and enable direct calls to various Swift functions.

This project can be divided into at least three separate areas and therefore potentially three separate workstreams.

Runtime: At the lowest level, ensuring that Swift can be called from .NET without an intermediate step through C or assembly is essential. This task must be implemented across all supported .NET runtimes targeting macOS and Apple mobile platforms.

Code-Generation: This layer involves the generation of C# bindings for Swift. The projection tooling consists of importing Swift into .NET, exporting .NET to Swift, and tool distribution.

End-user scenarios: At the highest level, it is crucial to address end-user scenarios. For instance, a MAUI-iOS developer should be able to create an iOS app that interacts seamlessly with Swift libraries and frameworks. The primary task at this level includes defining and managing the end-to-end process. This includes prioritizing Swift libraries and showcasing the support for .NET Swift interop.

User stories

@kotlarmilos kotlarmilos added Epic Groups multiple user stories. Can be grouped under a theme. area-Meta tracking This issue is tracking the completion of other related issues. labels Dec 5, 2023
@kotlarmilos kotlarmilos added this to the 9.0.0 milestone Dec 5, 2023
@kotlarmilos kotlarmilos self-assigned this Dec 5, 2023
@ghost
Copy link

ghost commented Dec 5, 2023

Tagging subscribers to this area: @dotnet/area-meta
See info in area-owners.md if you want to be subscribed.

Issue Details

Overview

The Swift programming language has a different ABI, runtime environment, and object model, making it challenging to call into from the .NET runtime. The goal is to establish .NET Interop support in the ecosystem and address Swift ABI differences. Apple's shift towards Swift highlights the importance of Maui being compatible with Swift libraries and frameworks to remain relevant in the Apple ecosystem. Ideally, the interop should operate with a minimal set of additional wrappers and enable direct calls to various Swift functions.

This project can be divided into at least three separate areas and therefore potentially three separate workstreams.

Runtime: At the lowest level, ensuring that Swift can be called from .NET without an intermediate step through C or assembly is essential. This task must be implemented across all supported .NET runtimes targeting OSX and Apple mobile platforms.

Code-Generation: This layer involves the generation of C# bindings for Swift. The projection tooling consists of importing Swift into .NET, exporting .NET to Swift, and tool distribution.

End-user scenarios: At the highest level, it is crucial to address end-user scenarios. For instance, a MAUI-iOS developer should be able to create an iOS app that interacts seamlessly with Swift libraries and frameworks. The primary task at this level includes defining and managing the end-to-end process. This includes prioritizing Swift libraries and showcasing the support for .NET Swift interop.

User stories

Author: kotlarmilos
Assignees: kotlarmilos
Labels:

Epic, area-Meta, tracking

Milestone: 9.0.0

@marek-safar marek-safar added the os-ios Apple iOS label Dec 6, 2023
@ghost
Copy link

ghost commented Dec 6, 2023

Tagging subscribers to 'os-ios': @steveisok, @akoeplinger, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

Issue Details

Overview

The Swift programming language has a different ABI, runtime environment, and object model, making it challenging to call into from the .NET runtime. The goal is to establish .NET Interop support in the ecosystem and address Swift ABI differences. Apple's shift towards Swift highlights the importance of Maui being compatible with Swift libraries and frameworks to remain relevant in the Apple ecosystem. Ideally, the interop should operate with a minimal set of additional wrappers and enable direct calls to various Swift functions.

This project can be divided into at least three separate areas and therefore potentially three separate workstreams.

Runtime: At the lowest level, ensuring that Swift can be called from .NET without an intermediate step through C or assembly is essential. This task must be implemented across all supported .NET runtimes targeting OSX and Apple mobile platforms.

Code-Generation: This layer involves the generation of C# bindings for Swift. The projection tooling consists of importing Swift into .NET, exporting .NET to Swift, and tool distribution.

End-user scenarios: At the highest level, it is crucial to address end-user scenarios. For instance, a MAUI-iOS developer should be able to create an iOS app that interacts seamlessly with Swift libraries and frameworks. The primary task at this level includes defining and managing the end-to-end process. This includes prioritizing Swift libraries and showcasing the support for .NET Swift interop.

User stories

Author: kotlarmilos
Assignees: kotlarmilos
Labels:

Epic, area-Meta, tracking, os-ios

Milestone: 9.0.0

@marek-safar marek-safar added the os-mac-os-x macOS aka OSX label Dec 6, 2023
@ShikiSuen
Copy link

Sorry for the interruption, but macOS is not OSX anymore.
The major version of macOS changed since 2020.
It is more appropriate to use the term macOS instead.

@kotlarmilos
Copy link
Member Author

kotlarmilos commented Jan 3, 2024

Thanks for your suggestion. The label description mentions macOS aka OSX. @marek-safar, please inform us if we should make any changes.

@kotlarmilos kotlarmilos changed the title Implement .NET Swift interop support targeting OSX and Apple mobile Implement .NET Swift interop support targeting macOS and Apple mobile Jan 3, 2024
@marek-safar
Copy link
Contributor

Mixing macOS and Apple seems odd. What about just naming explicitly macOS and iOS ?

@jkotas
Copy link
Member

jkotas commented Jan 3, 2024

What about just naming explicitly macOS and iOS ?

macCatalyst and tvOS too

We call these "Apple platforms" in many places in the repo, one example from many

internal static bool IsApplePlatform() =>
.

@jkotas jkotas changed the title Implement .NET Swift interop support targeting macOS and Apple mobile Implement .NET Swift interop support targeting Apple platforms Jan 3, 2024
@ShikiSuen
Copy link

ShikiSuen commented Jan 3, 2024

@jkotas These platforms have differences in available frameworks.
AppKit and InputMethodKit are only available on macOS.

If there is a dotNET equivalent of Swift #if canImport(XXXKit) then it should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Meta Epic Groups multiple user stories. Can be grouped under a theme. os-ios Apple iOS os-mac-os-x macOS aka OSX tracking This issue is tracking the completion of other related issues.
Projects
None yet
Development

No branches or pull requests

4 participants