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

[UIKit] Fix UIKit selector on TvOS #18617

Merged
merged 5 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions src/UIKit/UIMenu.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#if !WATCH
using System;
using System.Runtime.InteropServices;

using ObjCRuntime;
using Foundation;

namespace UIKit {
public partial class UIMenu {
#if !XAMCORE_5_0

#if NET
[SupportedOSPlatform ("tvos15.0")]
[SupportedOSPlatform ("ios15.0")]
[SupportedOSPlatform ("maccatalyst15.0")]
#else
[iOS (15, 0)]
mandel-macaque marked this conversation as resolved.
Show resolved Hide resolved
[TV (15,0)]
#endif
public virtual UIMenuElement [] SelectedElements {
get {
// check if we are on tvos earlier than 15, if so, return and empty array, else return
// the correct value
#if TVOS
if (SystemVersion.ChecktvOS (15, 0)) {
return _SelectedElements;
} else {
return Array.Empty<UIMenuElement> ();
}
#else
return _SelectedElements;
#endif
}
#endif
}
}
}
#endif
1 change: 1 addition & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ UIKIT_SOURCES = \
UIKit/UIKeyboard.cs \
UIKit/UIKitSynchronizationContext.cs \
UIKit/UIListSeparatorConfiguration.cs \
UIKit/UIMenu.cs \
UIKit/UINavigationBar.cs \
UIKit/UINavigationController.cs \
UIKit/UIPageViewController.cs \
Expand Down
7 changes: 6 additions & 1 deletion src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9157,9 +9157,14 @@ interface UIMenu {
[Export ("options")]
UIMenuOptions Options { get; }

[iOS (15, 0), MacCatalyst (15, 0)]
[iOS (15, 0), MacCatalyst (15, 0), TV (15, 0)]
[Export ("selectedElements")]
#if XAMCORE_5_0
UIMenuElement [] SelectedElements { get; }
#else
[Internal]
UIMenuElement [] _SelectedElements { get; }
#endif

[Export ("children")]
UIMenuElement [] Children { get; }
Expand Down
Loading