lascic / UIOnboarding

Apple-esque animated welcome screen for iOS and iPadOS. Configurable.
MIT License
713 stars 28 forks source link

Adopted trait registration API and fixed iOS 17 crash #19

Closed FelixLisczyk closed 1 year ago

FelixLisczyk commented 1 year ago

This PR fixes #15

iOS 17 calls traitCollectionDidChange(_:) earlier in the lifecycle when the view properties are not yet initialized. This causes a crash which can be avoided by checking if the view is already visible.

This PR also adopts the new trait registration API in iOS 17: https://developer.apple.com/videos/play/wwdc2023-10057/?time=1196

Note: I've added another commit to restore compatibility with Xcode 14 because the symbols UITraitHorizontalSizeClass and registerForTraitChanges are not available in this version.

FelixLisczyk commented 1 year ago

Great! Could you please merge this PR and create a new release? The Xcode 15 Release Candidate should be available in a few days, and many devs will submit their iOS 17 updates to the App Store shortly after. Thank you!