iOS version check inside widget extension

I tried to add iOS 17 version check inside WidgetBundle but the widget extension keep on crashing .

Getting Thread 1: Swift runtime failure: Unexpectedly found nil while unwrapping an Optional value. After removing the iOS 17 check it works fine.

Is there any way to provide version check inside widgetBundle?

The error suggests that a specific line in your code is incorrect, but you haven't given us any code to work with. What's the code on the line that causes the error?

Have a look here for some background on optionals.

iOS version check inside widget extension
 
 
Q