AXPhotosViewControllerDelegate
protocol AXPhotosViewControllerDelegate : AnyObject, NSObjectProtocol
AXPhotosViewControllerDelegate
-
Called when the
AXPhotosViewController
navigates to a new photo. This is defined as when the swipe percent between pages is greater than the threshold (>0.5).Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, didNavigateTo photo: AXPhotoProtocol, at index: Int)
Parameters
photosViewController
The
AXPhotosViewController
that is navigating.photo
The
AXPhoto
that was navigated to.index
The
index
in the dataSource of theAXPhoto
being transitioned to. -
Called when the
AXPhotosViewController
is configuring itsOverlayView
for a new photo. This should be used to update the the overlay’s title or any other overlay-specific properties.Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, willUpdate overlayView: AXOverlayView, for photo: AXPhotoProtocol, at index: Int, totalNumberOfPhotos: Int)
Parameters
photosViewController
The
AXPhotosViewController
that is updating the overlay.overlayView
The
AXOverlayView
that is being updated.photo
The
AXPhoto
the overlay is being configured for.index
The index of the
AXPhoto
that the overlay is being configured for.totalNumberOfPhotos
The total number of photos in the current
dataSource
. -
Called when the
AXPhotoViewController
will show/hide itsOverlayView
. This method will be called inside of an animation context, so perform any coordinated animations here.Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, overlayView: AXOverlayView, visibilityWillChange visible: Bool)
Parameters
photosViewController
The
AXPhotosViewController
that is updating the overlay visibility.overlayView
The
AXOverlayView
whose visibility is changing.visible
A boolean that denotes whether or not the overlay will be visible or invisible.
-
If implemented and returns a valid zoom scale for the photo (valid meaning >= the photo’s minimum zoom scale), the underlying zooming image view will adopt the returned
maximumZoomScale
instead of the default calculated by the library. A good implementation of this method will use a combination of the providedminimumZoomScale
andimageSize
to extrapolate amaximumZoomScale
to return. If theminimumZoomScale
is returned (ie.minimumZoomScale
==maximumZoomScale
), zooming will be disabled for this image.Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, maximumZoomScaleFor photo: AXPhotoProtocol, minimumZoomScale: CGFloat, imageSize: CGSize) -> CGFloat
Parameters
photosViewController
The
AXPhotosViewController
that is updating the photo’s zoom scale.photo
The
AXPhoto
that the zoom scale will affect.minimumZoomScale
The minimum zoom scale that is calculated by the library. This value cannot be changed.
imageSize
The size of the image that belongs to the
AXPhoto
.Return Value
A “maximum” zoom scale that >=
minimumZoomScale
. -
Called when the action button is tapped for a photo. If no implementation is provided, will fall back to default action.
Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, handleActionButtonTappedFor photo: AXPhotoProtocol)
Parameters
photosViewController
The
AXPhotosViewController
handling the action.photo
The related
Photo
. -
Called when an action button action is completed.
Note
This is only called for the default action.Declaration
Swift
func photosViewController(_ photosViewController: AXPhotosViewController, actionCompletedWith activityType: UIActivity.ActivityType, for photo: AXPhotoProtocol)
Parameters
photosViewController
The
AXPhotosViewController
that handled the action.photo
The related
AXPhoto
. -
Called just before the
AXPhotosViewController
begins its dismissalDeclaration
Swift
func photosViewControllerWillDismiss(_ photosViewController: AXPhotosViewController)
Parameters
photosViewController
The view controller being dismissed
-
Called after the
AXPhotosViewController
completes its dismissalDeclaration
Swift
func photosViewControllerDidDismiss(_ photosViewController: AXPhotosViewController)
Parameters
photosViewController
The dismissed view controller