4 Commits

Author SHA1 Message Date
Elvis Nunez c73d8292b5 Merge pull request #303 from kitwtnb/fix-build-error-for-main-actor-isolation
Fix build error for MainActor isolation.
2024-08-27 13:36:10 +02:00
Keita Watanabe de59c814c6 fix build error for MainActor isolation 2024-08-12 14:40:35 +09:00
Elvis Nunez f588347f58 Merge pull request #301 from kitwtnb/fix-existential-any
Fix existential-any for Swift6
2024-07-29 18:12:28 +02:00
Keita Watanabe dea5e8a4bd fix existential any 2024-07-15 16:27:21 +09:00
8 changed files with 35 additions and 26 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
protocol LayoutConfigurable: AnyObject {
@MainActor
func configureLayout()
}
+6 -6
View File
@@ -96,11 +96,11 @@ class LightboxTransition: UIPercentDrivenInteractiveTransition {
extension LightboxTransition: UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
func transitionDuration(using transitionContext: (any UIViewControllerContextTransitioning)?) -> TimeInterval {
return 0.25
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
func animateTransition(using transitionContext: any UIViewControllerContextTransitioning) {
let container = transitionContext.containerView
guard let fromView = transitionContext.view(forKey: UITransitionContextViewKey.from),
@@ -133,23 +133,23 @@ extension LightboxTransition: UIViewControllerAnimatedTransitioning {
extension LightboxTransition: UIViewControllerTransitioningDelegate {
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
func animationController(forDismissed dismissed: UIViewController) -> (any UIViewControllerAnimatedTransitioning)? {
dismissing = true
return self
}
func animationController(forPresented presented: UIViewController,
presenting: UIViewController,
source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
source: UIViewController) -> (any UIViewControllerAnimatedTransitioning)? {
dismissing = false
return self
}
func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
func interactionControllerForDismissal(using animator: any UIViewControllerAnimatedTransitioning) -> (any UIViewControllerInteractiveTransitioning)? {
return interactive ? self : nil
}
func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
func interactionControllerForPresentation(using animator: any UIViewControllerAnimatedTransitioning) -> (any UIViewControllerInteractiveTransitioning)? {
return interactive ? self : nil
}
}
+2
View File
@@ -9,6 +9,7 @@ public class LightboxConfig {
public static var imageBackgroundColor = UIColor.black
/// Provide a closure to handle selected video
@MainActor
public static var handleVideo: (_ from: UIViewController, _ videoURL: URL) -> Void = { from, videoURL in
let videoController = AVPlayerViewController()
videoController.player = AVPlayer(url: videoURL)
@@ -22,6 +23,7 @@ public class LightboxConfig {
public static var loadImage: ((UIImageView, URL, ((UIImage?) -> Void)?) -> Void)?
/// Indicator is used to show while image is being fetched
@MainActor
public static var makeLoadingIndicator: () -> UIView = {
return LoadingIndicator()
}
+12 -12
View File
@@ -1,29 +1,29 @@
import UIKit
public protocol LightboxControllerPageDelegate: AnyObject {
@MainActor
func lightboxController(_ controller: LightboxController, didMoveToPage page: Int)
}
public protocol LightboxControllerDismissalDelegate: AnyObject {
@MainActor
func lightboxControllerWillDismiss(_ controller: LightboxController)
}
public protocol LightboxControllerTouchDelegate: AnyObject {
@MainActor
func lightboxController(_ controller: LightboxController, didTouch image: LightboxImage, at index: Int)
}
public protocol LightboxControllerTapDelegate: AnyObject {
@MainActor
func lightboxController(_ controller: LightboxController, didTap image: LightboxImage, at index: Int)
@MainActor
func lightboxController(_ controller: LightboxController, didDoubleTap image: LightboxImage, at index: Int)
}
public protocol LightboxControllerDeleteDelegate: AnyObject {
@MainActor
func lightboxController(_ controller: LightboxController, willDeleteAt index: Int)
}
@@ -148,11 +148,11 @@ open class LightboxController: UIViewController {
}
}
open weak var pageDelegate: LightboxControllerPageDelegate?
open weak var dismissalDelegate: LightboxControllerDismissalDelegate?
open weak var imageTouchDelegate: LightboxControllerTouchDelegate?
open weak var imageTapDelegate: LightboxControllerTapDelegate?
open weak var imageDeleteDelegate: LightboxControllerDeleteDelegate?
open weak var pageDelegate: (any LightboxControllerPageDelegate)?
open weak var dismissalDelegate: (any LightboxControllerDismissalDelegate)?
open weak var imageTouchDelegate: (any LightboxControllerTouchDelegate)?
open weak var imageTapDelegate: (any LightboxControllerTapDelegate)?
open weak var imageDeleteDelegate: (any LightboxControllerDeleteDelegate)?
open internal(set) var presented = false
open fileprivate(set) var seen = false
@@ -232,7 +232,7 @@ open class LightboxController: UIViewController {
// MARK: - Rotation
override open func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
override open func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
coordinator.animate(alongsideTransition: { _ in
+2 -2
View File
@@ -1,7 +1,7 @@
import UIKit
public protocol FooterViewDelegate: AnyObject {
@MainActor
func footerView(_ footerView: FooterView, didExpand expanded: Bool)
}
@@ -35,7 +35,7 @@ open class FooterView: UIView {
}()
let gradientColors = [UIColor(hex: "040404").withAlphaComponent(0.1), UIColor(hex: "040404")]
open weak var delegate: FooterViewDelegate?
open weak var delegate: (any FooterViewDelegate)?
// MARK: - Initializers
+3 -1
View File
@@ -1,7 +1,9 @@
import UIKit
protocol HeaderViewDelegate: AnyObject {
@MainActor
func headerView(_ headerView: HeaderView, didPressDeleteButton deleteButton: UIButton)
@MainActor
func headerView(_ headerView: HeaderView, didPressCloseButton closeButton: UIButton)
}
@@ -60,7 +62,7 @@ open class HeaderView: UIView {
return button
}()
weak var delegate: HeaderViewDelegate?
weak var delegate: (any HeaderViewDelegate)?
// MARK: - Initializers
+2 -2
View File
@@ -1,7 +1,7 @@
import UIKit
public protocol InfoLabelDelegate: AnyObject {
@MainActor
func infoLabel(_ infoLabel: InfoLabel, didExpand expanded: Bool)
}
@@ -20,7 +20,7 @@ open class InfoLabel: UILabel {
return "... \(LightboxConfig.InfoLabel.ellipsisText)"
}
open weak var delegate: InfoLabelDelegate?
open weak var delegate: (any InfoLabelDelegate)?
fileprivate var shortText = ""
var fullText: String {
+7 -2
View File
@@ -1,12 +1,17 @@
import UIKit
protocol PageViewDelegate: AnyObject {
@MainActor
func pageViewDidZoom(_ pageView: PageView)
@MainActor
func remoteImageDidLoad(_ image: UIImage?, imageView: UIImageView)
@MainActor
func pageView(_ pageView: PageView, didTouchPlayButton videoURL: URL)
@MainActor
func pageViewDidTouch(_ pageView: PageView)
@MainActor
func pageViewDidTap(_ pageView: PageView)
@MainActor
func pageViewDidDoubleTap(_ pageView: PageView)}
class PageView: UIScrollView {
@@ -50,7 +55,7 @@ class PageView: UIScrollView {
var image: LightboxImage
var contentFrame = CGRect.zero
weak var pageViewDelegate: PageViewDelegate?
weak var pageViewDelegate: (any PageViewDelegate)?
var hasZoomed: Bool {
return zoomScale != 1.0