SwiftMessages icon indicating copy to clipboard operation
SwiftMessages copied to clipboard

Crash on iPadOS 18.0+ using presentationstyle = .bottom

Open dylanwestOFW opened this issue 1 year ago • 1 comments

Due to the changes made to UITabbar in ipadOS 18.0+, SwiftMessages is crashing when trying to set the constraints for the bottom view. I believe this is an issue specifically with the function bottomLayoutConstraint(view:, containerView:, viewController:) in Presenter.swift. The specific crash is because we are trying to attach an anchor to the top of the tabBar which no longer exists on ipadOS 18+. I think it should check if there is a tabBar top constraint before trying to attach the view. image

dylanwestOFW avatar Dec 09 '24 19:12 dylanwestOFW

See the same issue at my end. In the interim what could potentially solve the issue is setting the context to window.

When the context isAutomatic or ViewController and the presentationStyle is set to .bottom,I feel it tries to locate a TabBar to attach to and since one does exist, it tries to use the bottom constraint, which would traditionally work but probably doesn't exist in iPadOS 18 as it floats at the top which causes the crash.

So this temporarily seems to solve it for me:

var config = SwiftMessages.Config()
config.presentationContext = .window(windowLevel: .normal)

shawn-frank avatar Mar 20 '25 04:03 shawn-frank

10.0.2

Sorry for not formally releasing this sooner.

wtmoose avatar Sep 04 '25 02:09 wtmoose