-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6b68141
commit e17c2ea
Showing
1 changed file
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// ModalViewControllerMetrics.swift | ||
// react-native-ios-modal | ||
// | ||
// Created by Dominic Go on 9/27/24. | ||
// | ||
|
||
import Foundation | ||
import DGSwiftUtilities | ||
|
||
|
||
public struct ModalViewControllerMetrics: Encodable { | ||
|
||
public var isBeingDismissed: Bool; | ||
public var isBeingPresented: Bool; | ||
public var isPresentedAsModal: Bool; | ||
|
||
public var modalLevel: Int; | ||
public var topmostModalLevel: Int; | ||
public var isTopMostModal: Bool; | ||
|
||
public var hasPanGesture: Bool; | ||
public var isPanGestureEnabled: Bool; | ||
|
||
public var modalPresentationStyle: String; | ||
public var isUsingSheetPresentationController: Bool; | ||
|
||
public init(viewController modalVC: UIViewController){ | ||
|
||
self.isBeingDismissed = modalVC.isBeingDismissed | ||
self.isBeingPresented = modalVC.isBeingPresented | ||
self.isPresentedAsModal = modalVC.isPresentedAsModal; | ||
|
||
self.modalLevel = modalVC.modalLevel ?? -1; | ||
self.topmostModalLevel = modalVC.topmostModalLevel ?? -1; | ||
self.isTopMostModal = modalVC.isTopMostModal; | ||
|
||
let modalGesture = modalVC.closestSheetPanGesture; | ||
self.hasPanGesture = modalGesture != nil; | ||
self.isPanGestureEnabled = modalGesture?.isEnabled ?? false; | ||
|
||
self.modalPresentationStyle = modalVC.modalPresentationStyle.caseString; | ||
|
||
self.isUsingSheetPresentationController = | ||
modalVC.isUsingSheetPresentationController; | ||
}; | ||
}; |