Skip to content

Github 242 - Fix missing import in generated .h and correct ns in designer.cs#243

Open
Prochy wants to merge 5 commits intodotnet:mainfrom
Prochy:dev/hotfix/242-custom-controls-are-not-imported-in-h-files
Open

Github 242 - Fix missing import in generated .h and correct ns in designer.cs#243
Prochy wants to merge 5 commits intodotnet:mainfrom
Prochy:dev/hotfix/242-custom-controls-are-not-imported-in-h-files

Conversation

@Prochy
Copy link
Copy Markdown

@Prochy Prochy commented Apr 15, 2026

Summary

This PR improves how xcsync generates Objective-C / C# interop code and fixes a few related bugs in sync/watch behavior.

The main issue was that generated files were not always correct: some .h files were missing required imports, designer.cs could end up with the wrong namespace, and outlet/action parameter types were sometimes mapped incorrectly when Clang reported pointer-like types such as int*. On top of that, sync/watch gained an explicit types option so generated code can be more predictable when type inference is not enough.

What changed

  • Fixed missing imports in generated .h files.
  • Corrected namespace generation in designer.cs.
  • Improved outlet/action type mapping, especially for Clang-reported pointer types.
  • Added support for an explicit types option in sync.
    Currently all action parameters types converted from XCode to C# were created as NSObject event though in a header file was a different type. It's user unfriendly so I extended with -e option (--explicit-types) not to break compatibility. Valid for sync/watch command

Added and expanded tests around the rewriter, type mapping, sync/watch commands, and generated files.
Issue addressed
The issue was that xcsync could generate code that was incomplete or inconsistent:

imports were sometimes missing from generated header files,
generated designer code could use the wrong namespace,
some action/outlet parameter types were inferred incorrectly,
and users had no way to force explicit generated types when needed.

Microsoft Reviewers: Open in CodeFlow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants