iZettle / Presentation

Presentation is an iOS Swift library for working with UI presentations in a more structured way
MIT License
72 stars 11 forks source link

iOS 13 modal sheets (issue #41) #43

Closed nataliq closed 5 years ago

nataliq commented 5 years ago

What's new: On iOS 13 we have new default modal presentation called Sheet. The modal Sheets can be dismissed by swiping them down, and in doing so, Presentation framework wasn't disposing the bag of its presentation. This PR makes Presentation's view controller to conform to UIAdaptivePresentationDelegate that will handle actions for when the view attempt's, will and did dismiss and disposing the bag appropriately when the view dismisses.

In addition, it adds functionality for the developer to pass a block of code when the view attempts to dismiss through a signal in CustomAdaptivePresentationDelegate like this

vc.customAdaptivePresentationDelegate.didAttemptToDismissSignal.onValue { ... }

The didAttemptToDismissSignal will fire only if the view controller that's presented has .isModalInPresentation = true and then the developer can execute a block with what they want to happen when the user attempt to dismiss (optional)

This PR also includes a temp solution for #40

More info: #41

iZNunev commented 5 years ago

I've added a new file to presentation and it the test-iOS on Circle-CI is failing due to

Build input file cannot be found: '/System/Volumes/Data/Users/vasil-nunev/Presentation/Presentation/CustomAdaptivePresentationDelegate.swift' (in target 'Presentation')

Anyone knows how to fix this?