forked from slackhq/PanModal
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from croquiscom/feature/APP-11532-panModal-lif…
…ecycle APP-11532 : 팬모달 라이프사이클 이벤트 별도로 추가
- Loading branch information
Showing
8 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
PanModal/Controller/PanModalPresentationController+Event.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import UIKit | ||
import Combine | ||
|
||
extension PanModalPresentationController { | ||
// MARK: - Internal Event Emitters | ||
func notifyWillPresent() { | ||
(presentedViewController as? PanModalPresentable)?.panModalWillPresent() | ||
if #available(iOS 13.0, *) { | ||
PanModalLifeCycleEventPublisher.shared.notify(.willPresent(viewController: presentedViewController)) | ||
} | ||
} | ||
|
||
func notifyDidPresent() { | ||
(presentedViewController as? PanModalPresentable)?.panModalDidPresent() | ||
if #available(iOS 13.0, *) { | ||
PanModalLifeCycleEventPublisher.shared.notify(.didPresent(viewController: presentedViewController)) | ||
} | ||
} | ||
|
||
func notifyWillDismiss() { | ||
(presentedViewController as? PanModalPresentable)?.panModalWillDismiss() | ||
if #available(iOS 13.0, *) { | ||
PanModalLifeCycleEventPublisher.shared.notify(.willDismiss(viewController: presentedViewController)) | ||
} | ||
} | ||
|
||
func notifyDidDismiss() { | ||
(presentedViewController as? PanModalPresentable)?.panModalDidDismiss() | ||
if #available(iOS 13.0, *) { | ||
PanModalLifeCycleEventPublisher.shared.notify(.didDismiss(viewController: presentedViewController)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import Combine | ||
|
||
public enum PanModalLifeCycleEvent { | ||
case willPresent(viewController: UIViewController) | ||
case didPresent(viewController: UIViewController) | ||
case willDismiss(viewController: UIViewController) | ||
case didDismiss(viewController: UIViewController) | ||
} | ||
|
||
@available(iOS 13.0, *) | ||
public final class PanModalLifeCycleEventPublisher { | ||
public static let shared = PanModalLifeCycleEventPublisher() | ||
|
||
public let publisher = PassthroughSubject<PanModalLifeCycleEvent, Never>() | ||
|
||
private init() {} | ||
|
||
func notify(_ event: PanModalLifeCycleEvent) { | ||
publisher.send(event) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters