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

UIApplication.SharedApplication.PreferredContentSizeCategory has no type safe wrapper #15687

Closed
ivanlabsii opened this issue Aug 17, 2022 · 2 comments · Fixed by #15800
Closed
Labels
enhancement The issue or pull request is an enhancement help wanted This is an issue or pull request where we request help from the community to fix or complete
Milestone

Comments

@ivanlabsii
Copy link

Steps to Reproduce

  1. Type var size = UIApplication.SharedApplication.PreferredContentSizeCategory;

Expected Behavior

It should be UIContentSizeCategory (even tootltip says that)

Actual Behavior

It is NSString

Environment

Version information
Visual Studio Community 2022 for Mac
Version 17.3.1 (build 411)
Installation UUID: 03c67a7d-2102-4c61-b863-82e53245ffed

Runtime
.NET 6.0.5 (64-bit)
Architecture: X64

Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608

NuGet
Version: 6.2.1.2

.NET SDK (x64)
SDK: /usr/local/share/dotnet/sdk/6.0.400/Sdks
SDK Versions:
	6.0.400
	6.0.302
	6.0.301
	5.0.408
	5.0.407
	5.0.406
	5.0.405
	5.0.404
	5.0.403
	5.0.402
	5.0.401
	5.0.400
	5.0.302
	5.0.301
	5.0.203
	5.0.202
	5.0.201
	5.0.103
	5.0.102
	5.0.101
	5.0.100
	3.1.422
	3.1.421
	3.1.420
	3.1.419
	3.1.418
	3.1.417
	3.1.416
	3.1.415
	3.1.414
	3.1.413
	3.1.412
	3.1.411
	3.1.410
	3.1.409
	3.1.408
	3.1.407
	3.1.406
	3.1.405
	3.1.404
	3.1.403
	3.1.402
	3.1.401
	3.1.302
	3.1.301
	3.1.300
	3.1.202
	3.1.200
	3.1.102
	3.1.101
	3.1.100
	3.0.101
	3.0.100
	2.1.701
	2.1.700
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	6.0.8
	6.0.7
	6.0.6
	5.0.17
	5.0.16
	5.0.15
	5.0.14
	5.0.13
	5.0.12
	5.0.11
	5.0.10
	5.0.9
	5.0.8
	5.0.7
	5.0.6
	5.0.5
	5.0.4
	5.0.3
	5.0.2
	5.0.1
	5.0.0
	3.1.28
	3.1.27
	3.1.26
	3.1.25
	3.1.24
	3.1.23
	3.1.22
	3.1.21
	3.1.20
	3.1.19
	3.1.18
	3.1.17
	3.1.16
	3.1.15
	3.1.14
	3.1.13
	3.1.12
	3.1.11
	3.1.10
	3.1.9
	3.1.8
	3.1.7
	3.1.6
	3.1.5
	3.1.4
	3.1.2
	3.1.1
	3.1.0
	3.0.1
	3.0.0
	2.1.23
	2.1.22
	2.1.21
	2.1.20
	2.1.19
	2.1.18
	2.1.17
	2.1.16
	2.1.15
	2.1.14
	2.1.13
	2.1.12
	2.1.11

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

Updater
Version: 11

Apple Developer Tools
Xcode 13.4.1 (20504)
Build 13F100

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-08-11 21:29:58 UTC

Xamarin.Android
Version: 13.0.0.0 (Visual Studio Community)
Commit: xamarin-android/d17-3/030cd63
Android SDK: /Users/ivanicin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		12.0 (API level 31)
		11.0 (API level 30)
		10.0 (API level 29)
		9.0  (API level 28)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information: 
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-08-11 21:30:03 UTC

Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-08-11 21:30:03 UTC

Build Information
Release ID: 1703010411
Git revision: 22408f3ad66bf33ab9530b882011bed98ebf1503
Build date: 2022-08-11 21:28:07+00
Build branch: release-17.3
Build lane: release-17.3

Operating System
Mac OS X 12.5.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
    Sat Jun 18 17:07:25 PDT 2022
    root:xnu-8020.140.41~1/RELEASE_X86_64 x86_64


Build Logs

Example Project (If Possible)

@chamons
Copy link
Contributor

chamons commented Aug 24, 2022

You can convert this with UIContentSizeCategoryExtensions.GetValue(UIApplication.SharedApplication.PreferredContentSizeCategory) but we generally provide a type safe helper for you (We haven't here yet).

@chamons chamons changed the title UIApplication.SharedApplication.PreferredContentSizeCategory should be UIContentSizeCategory UIApplication.SharedApplication.PreferredContentSizeCategory has no type safe wrapper Aug 24, 2022
@chamons chamons added enhancement The issue or pull request is an enhancement help wanted This is an issue or pull request where we request help from the community to fix or complete labels Aug 24, 2022
@chamons chamons added this to the Future milestone Aug 24, 2022
@ivanlabsii
Copy link
Author

@chamons thanks, I did find a workaround by finding the string value to compare before posting this. This workaround sounds better.

haritha-mohan added a commit to haritha-mohan/xamarin-macios that referenced this issue Aug 29, 2022
Fixes dotnet#15687
Added type safe wrapper for ContentSizeCategory
haritha-mohan added a commit to haritha-mohan/xamarin-macios that referenced this issue Aug 29, 2022
Fixes dotnet#15687
Added type safe wrapper for ContentSizeCategory
haritha-mohan added a commit that referenced this issue Aug 31, 2022
Fixes #15687
Added type safe wrapper for ContentSizeCategory

Co-authored-by: Rolf Bjarne Kvinge <[email protected]>
Co-authored-by: TJ Lambert <[email protected]>
@ghost ghost locked as resolved and limited conversation to collaborators Oct 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement The issue or pull request is an enhancement help wanted This is an issue or pull request where we request help from the community to fix or complete
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants