No way to access preferredContentSizeCategory in Widget

Originator:patrick
Number:rdar://31706546 Date Originated:19-Apr.-2017 03:58 PM
Status:Closed Resolved:
Product:iOS + SDK Product Version:Xcode 8.3.1 (8E1000a)
Classification:Enhancement Reproducible:Always
 
Summary:
When creating a today widget there is no way to get the preferredContentSizeCategory in iOS 10.3.

The underlying problem is that UIApplication.shared is not available in widgets, and that this is the only official way to access the currently selected content size category of the user.

Steps to Reproduce:
1) create a today widget target in Xcode
2) try to access the current preferredContentSizeCategory in -viewDidLoad or somewhere else

Expected Results:
It´s possible to access preferredContentSizeCategory in the widget

Actual Results:
Compiler error: „UIApplication.shared“ is unavailable and there’s no other way to access the current preferredContentSizeCategory

Version:
Xcode 8.3.1 (8E1000a)

Notes:
Notification „UIContentSizeCategoryDidChange“ works fine to be notified about changes of the preferredContentSizeCategory, but we need to access the current preferredContentSizeCategory when the widget is started, not only when a change happens

Comments

We found a way to access the preferredContentSizeCategory over "self.traitCollection.preferredContentSizeCategory"


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!