Custom controls are not imported in .h file when generating XCode prj
- Dominant language
- C#
- Stars
- 25
- Forks
- 10
- Avg merge
- 12h 50m
- Merged PRs (30d)
- 10
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Apple platform
macOS
### Framework version
Other
### Describe the bug
If I have such a custom control
```
[Register("PrimaryButton")]
public class PrimaryButton : NSButton
{
public PrimaryButton(NativeHandle handle) : base(handle)
{
Initialize();
}
private void Initialize()
{
SetButtonType(NSButtonType.MomentaryPushIn);
UpdateBezelColor();
}
private void UpdateBezelColor() => BezelColor = Enabled ? NSColor.ControlAccent : null;
public override bool Enabled
{
get => base.Enabled;
set
{
base.Enabled = value;
UpdateBezelColor();
}
}
}
```
and later this code
```
namespace TestCustomControl
{
[Register ("ViewController")]
partial class ViewController
{
[Outlet]
TestCustomControl.PrimaryButton CustomButton { get; set; }
void ReleaseDesignerOutlets ()
{
if (CustomButton != null) {
CustomButton.Dispose ();
CustomButton = null;
}
}
}
}
```
`xcsync generate ` generates ViewController.h file without import PrimaryButton.
```
#import
#import
@interface ViewController : NSViewController {
PrimaryButton *_CustomButton;
}
@property (nonatomic, retain) IBOutlet PrimaryButton *CustomButton;
@end
```
This breaks sync command because it cannot probably resolve the PrimaryButton object and it will generate ViewController without PrimaryButton outlet.
### Expected Behavior
The .h file is generated with correct import files.
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version info
```
dotnet dotnet --info
.NET SDK:
Version: 10.0.201
Commit: 4d3023de60
Workload version: 10.0.201
MSBuild version: 18.3.0-release-26153-122+4d3023de6
Runtime Environment:
OS Name: Mac OS X
OS Version: 26.4
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/10.0.201/
.NET workloads installed:
[macos]
Installation Source: SDK 10.0.200
Manifest Version: 26.2.10217/10.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/10.0.100/microsoft.net.sdk.macos/26.2.10217/WorkloadManifest.json
Install Type: FileBased
[maui-maccatalyst]
Installation Source: SDK 10.0.200
Manifest Version: 10.0.20/10.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/10.0.100/microsoft.net.sdk.maui/10.0.20/WorkloadManifest.json
Install Type: FileBased
[maccatalyst]
Installation Source: SDK 10.0.200
Manifest Version: 26.2.10217/10.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/10.0.100/microsoft.net.sdk.maccatalyst/26.2.10217/WorkloadManifest.json
Install Type: FileBased
[wasm-tools-net6]
Installation Source: SDK 10.0.200
Manifest Version: 10.0.105/10.0.100
Manifest Path: /usr/local/share/dotnet/sdk-manifests/10.0.100/microsoft.net.workload.mono.toolchain.net6/10.0.105/WorkloadManifest.json
Install Type: FileBased
```
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.