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

Incorrect SupportedOSPlatform attribute on UIScrollViewKeyboardDismissMode enum #19066

Closed
tipa opened this issue Sep 20, 2023 · 3 comments · Fixed by #19069
Closed

Incorrect SupportedOSPlatform attribute on UIScrollViewKeyboardDismissMode enum #19066

tipa opened this issue Sep 20, 2023 · 3 comments · Fixed by #19069
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@tipa
Copy link

tipa commented Sep 20, 2023

Steps to Reproduce

  1. Use UIScrollViewKeyboardDismissMode.InteractiveWithAccessory or UIScrollViewKeyboardDismissMode.OnDragWithAccessory in a project with MinimumOSVersion < 16.0

Expected Behavior

No warning

Actual Behavior

Screenshot 2023-09-20 at 1 38 26 PM

The Apple docs describe the enum values to be available since iOS 7. I also confirmed that using the enum on a device with iOS 15 works as expected.
https://developer.apple.com/documentation/uikit/uiscrollviewkeyboarddismissmode/uiscrollviewkeyboarddismissmodeondragwithaccessory?language=objc

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.6.4 (build 472)
Installation UUID: 5db8407a-b72b-481f-b1e2-c25c7a3867ef

Runtime
.NET 7.0.3 (64-bit)
Architecture: Arm64
Microsoft.macOS.Sdk 13.1.1007; git-rev-head:8afca776a0a96613dfb7200e0917bb57f9ed5583; git-branch:release/7.0.1xx-xcode14.2

Roslyn (Language Service)
4.6.0-3.23180.6+99e956e42697a6dd886d1e12478ea2b27cceacfa

NuGet
Version: 6.4.0.117

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.401/Sdks
SDK Versions:
	7.0.401
	6.0.414
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	7.0.11
	6.0.22

Xamarin.Profiler
Version: 1.8.0.49
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode: 14.3.1 21815
Build: 14E300c

Xamarin.Mac
Version: 9.3.0.6 Visual Studio Community
Hash: 97731c92c
Branch: xcode14.3
Build date: 2023-04-11 22:38:35-0400

Xamarin.iOS
Version: 16.4.0.6 Visual Studio Community
Hash: 97731c92c
Branch: xcode14.3
Build date: 2023-04-11 22:38:36-0400

Xamarin Designer
Version: 17.6.3.9
Hash: 2648399ae8
Branch: remotes/origin/d17-6
Build date: 2023-09-07 02:05:20 UTC

Xamarin.Android
Not Installed

Microsoft Build of OpenJDK
Java SDK: Not Found

Eclipse Temurin JDK
Java SDK: Not Found

Android SDK Manager
Version: 17.6.0.50
Hash: a715dca
Branch: HEAD
Build date: 2023-09-07 02:05:26 UTC

Android Device Manager
Version: 0.0.0.1309
Hash: 06e3e77
Branch: HEAD
Build date: 2023-09-07 02:05:26 UTC

Build Information
Release ID: 1706040472
Git revision: 0b8c2cb9f01ef14a2b07ff4ea047268c8756fee6
Build date: 2023-09-07 02:03:50+00
Build branch: release-17.6
Build lane: release-17.6

Operating System
Mac OS X 13.5.2
Darwin 22.6.0 Darwin Kernel Version 22.6.0
    Wed Jul  5 22:22:52 PDT 2023
    root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 arm64

@rolfbjarne
Copy link
Member

This is interesting, because these two values were added in Xcode 14.0.

The header from Xcode 13.3:

typedef NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) {
    UIScrollViewKeyboardDismissModeNone,
    UIScrollViewKeyboardDismissModeOnDrag,      // dismisses the keyboard when a drag begins
    UIScrollViewKeyboardDismissModeInteractive, // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
} API_AVAILABLE(ios(7.0));

and the header from Xcode 14:

typedef NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) {
    UIScrollViewKeyboardDismissModeNone,
    UIScrollViewKeyboardDismissModeOnDrag,      // dismisses the keyboard when a drag begins
    UIScrollViewKeyboardDismissModeInteractive, // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
    UIScrollViewKeyboardDismissModeOnDragWithAccessory,       // dismisses both keyboard and accessory in the style of UIScrollViewKeyboardDismissModeOnDrag
    UIScrollViewKeyboardDismissModeInteractiveWithAccessory   // dismisses both keyboard and accessory in the style of UIScrollViewKeyboardDismissModeInteractive
} API_AVAILABLE(ios(7.0));

The updated header says all the values in the enum were available since iOS 7.0 (which may or may not be a mistake), and I believe the web site is just produced from the headers (so if the headers are wrong, the website would be too).

But you say this works fine in iOS 15, so this is at least somewhat backwards compatible, so I'll just fix the attributes for these two values.

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Sep 20, 2023
…KeyboardDismissMode. Fixes xamarin#19066.

These members were introduced in Xcode 14, but seems to be backwards
compatible on iOS and Mac Catalyst (according to headers, documentation, and
the reporter).

Fixes xamarin#19066.
@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Sep 20, 2023
@rolfbjarne rolfbjarne added this to the Future milestone Sep 20, 2023
@tipa
Copy link
Author

tipa commented Sep 20, 2023

I also wasn't aware of those new enums, they must be somewhat new. But they appear to be backwards-compatible

rolfbjarne added a commit that referenced this issue Sep 21, 2023
…KeyboardDismissMode. Fixes #19066. (#19069)

These members were introduced in Xcode 14, but seems to be backwards
compatible on iOS and Mac Catalyst (according to headers, documentation,
and the reporter).

Fixes #19066.
@tipa
Copy link
Author

tipa commented Sep 21, 2023

@rolfbjarne is it possible that the same oddity applies to NSParagraph TextLists property?

https://developer.apple.com/documentation/uikit/nsparagraphstyle/1534193-textlists?language=objc

xamarin-macios/src/xkit.cs

Lines 1797 to 1799 in 3436992

[iOS (16, 0), TV (16, 0), NoWatch, MacCatalyst (16, 0)]
[Export ("textLists")]
NSTextList [] TextLists { get; [NotImplemented] set; }

I haven't tested functionality yet, but at least setting & getting the property does not crash on iOS 15:

var xx = new NSMutableParagraphStyle();
xx.TextLists = new[] { new NSTextList(NSTextListMarkerFormats.Circle) };
var yy = xx.TextLists[0];

Also this, and probably even more:
https://developer.apple.com/documentation/uikit/nsparagraphstyle/3667463-linebreakstrategy?language=objc

xamarin-macios/src/xkit.cs

Lines 1811 to 1814 in 3436992

[Mac (11, 0), Watch (7, 0), TV (14, 0), iOS (14, 0)]
[MacCatalyst (14, 0)]
[Export ("lineBreakStrategy")]
NSLineBreakStrategy LineBreakStrategy { get; [NotImplemented] set; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
2 participants