SwiftKickMobile / SwiftMessages

A very flexible message bar for UIKit and SwiftUI.
MIT License
7.24k stars 742 forks source link

Adding option to present modal over context #403

Closed tbaranes closed 3 years ago

tbaranes commented 3 years ago

I have a use case where I need to present a modal over a dedicated controller on iPad (kinda like a split view controller homemade). So, I searched If there was an option to do this but didn't find any, so here it is.

I think it's the right way to do this, but I don't know if it's there right way in SwiftMessages, let me know if any changes is needed.

wtmoose commented 3 years ago

I think I'd do something a little bit more generic:

/**
 Normally, the destination view controller's `modalPresentationStyle` is changed 
 to `.custom` in the `perform()` function. Set this property to `false` to prevent it from
 being overridden.
*/
public var overrideModalPresentationStyle: Bool = true

...

if overrideModalPresentationStyle {
    destination.modalPresentationStyle = .custom
}
tbaranes commented 3 years ago

Sounds good to me, I changed it.

wtmoose commented 3 years ago

Looks good, thanks!