Skip to content

[.NET10] Made MauiCollectionView on iOS public #29917

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

Merged
merged 3 commits into from
Jun 20, 2025

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jun 10, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issues Fixed

Fixes #29844

@Copilot Copilot AI review requested due to automatic review settings June 10, 2025 22:55
@kubaflo kubaflo requested a review from a team as a code owner June 10, 2025 22:55
@kubaflo kubaflo requested review from PureWeen and jsuarezruiz June 10, 2025 22:55
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR exposes the MauiCollectionView handler on iOS and Mac Catalyst by making the class public and updating the public API listings.

  • Changed MauiCollectionView visibility from internal to public
  • Updated PublicAPI.Unshipped.txt for both net-ios and net-maccatalyst to include the new public API entries
  • Removed duplicate XmlnsDefinitionAttribute removal entry in the net-ios API file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt Added MauiCollectionView entries for Mac Catalyst public API
src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt Added MauiCollectionView entries and fixed duplicate removal
src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs Changed MauiCollectionView from internal to public
Comments suppressed due to low confidence (2)

src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:8

  • [nitpick] The newly public MauiCollectionView should have corresponding XML docs under /docs/ that describe its purpose, usage, and public members.
public class MauiCollectionView : UICollectionView, IUIViewLifeCycleEvents, IPlatformMeasureInvalidationController

src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:8

  • New public handler behavior should be covered by UI tests in TestCases.HostApp and by shared tests in TestCases.Shared.Tests—please add or update test cases accordingly.
public class MauiCollectionView : UICollectionView, IUIViewLifeCycleEvents, IPlatformMeasureInvalidationController

@@ -590,4 +594,5 @@ Microsoft.Maui.Controls.Xaml.Internals.AllowImplicitXmlnsDeclarationAttribute
Microsoft.Maui.Controls.Xaml.Internals.AllowImplicitXmlnsDeclarationAttribute.Allow.get -> bool
Microsoft.Maui.Controls.Xaml.Internals.AllowImplicitXmlnsDeclarationAttribute.AllowImplicitXmlnsDeclarationAttribute(bool allow = true) -> void
~Microsoft.Maui.Controls.XmlnsDefinitionAttribute.Target.get -> string
*REMOVED*~Microsoft.Maui.Controls.XmlnsDefinitionAttribute.XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace) -> void
Copy link
Preview

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s a duplicate removal entry for XmlnsDefinitionAttribute.XmlnsDefinitionAttribute on line 598—one of these should be removed.

Suggested change
*REMOVED*~Microsoft.Maui.Controls.XmlnsDefinitionAttribute.XmlnsDefinitionAttribute(string xmlNamespace, string clrNamespace) -> void

Copilot uses AI. Check for mistakes.

@kubaflo kubaflo changed the title [.NET10] Make MauiCollectionView on iOS public [.NET10] Made MauiCollectionView on iOS public Jun 10, 2025
@kubaflo kubaflo self-assigned this Jun 10, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label Jun 10, 2025
@PureWeen PureWeen added this to the .NET 10.0-preview6 milestone Jun 10, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Jun 10, 2025
@@ -65,13 +69,13 @@ public override void MovedToWindow()
}
}

internal void SetCustomDelegate(ICustomMauiCollectionViewDelegate customDelegate)
public void SetCustomDelegate(ICustomMauiCollectionViewDelegate customDelegate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmmm

I wonder if we can replace this with

IUIViewLifeCycleEvents and use a weak event handler inside MauiCollectionView

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're thinking about getting rid of public void SetCustomDelegate(ICustomMauiCollectionViewDelegate customDelegate and WeakReference<ICustomMauiCollectionViewDelegate>? _customDelegate;

so that devs would do something like this:

class MyHandler
{
	public MyHandler(MauiCollectionView collectionView)
	{
		((IUIViewLifeCycleEvents)collectionView).MovedToWindow += (s, e) =>
		{

		};
	}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PureWeen I've added a commit

@jsuarezruiz
Copy link
Contributor

/azp run

@jsuarezruiz jsuarezruiz added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label Jun 11, 2025
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we delete ICustomMauiCollectionViewDelegate

@github-project-automation github-project-automation bot moved this from Ready To Review to Changes Requested in MAUI SDK Ongoing Jun 12, 2025
@PureWeen
Copy link
Member

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in MAUI SDK Ongoing Jun 20, 2025
@PureWeen PureWeen merged commit 46838d6 into dotnet:net10.0 Jun 20, 2025
127 of 130 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution p/0 Work that we can't release without
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants