diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 00000000..5586a99a Binary files /dev/null and b/.DS_Store differ diff --git a/Instructions.xcodeproj/project.pbxproj b/Instructions.xcodeproj/project.pbxproj index 7680d70a..8211554e 100644 --- a/Instructions.xcodeproj/project.pbxproj +++ b/Instructions.xcodeproj/project.pbxproj @@ -741,7 +741,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -771,7 +771,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -920,7 +920,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -949,7 +949,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; + SWIFT_VERSION = 6.0; }; name = Release; }; diff --git a/Sources/Instructions/Core/Internal/CoachMarksViewController.swift b/Sources/Instructions/Core/Internal/CoachMarksViewController.swift index 8ae76e57..6f44cadd 100644 --- a/Sources/Instructions/Core/Internal/CoachMarksViewController.swift +++ b/Sources/Instructions/Core/Internal/CoachMarksViewController.swift @@ -108,7 +108,7 @@ class CoachMarksViewController: UIViewController { } deinit { - deregisterFromSystemEventChanges() + NotificationCenter.default.removeObserver(self) } // Called after the view was loaded. @@ -217,7 +217,7 @@ class CoachMarksViewController: UIViewController { func detachFromWindow() { switch presentationFashion { case .window: - deregisterFromSystemEventChanges() + NotificationCenter.default.removeObserver(self) let window = view.window window?.isHidden = true window?.rootViewController = nil @@ -227,7 +227,7 @@ class CoachMarksViewController: UIViewController { self.willMove(toParent: nil) self.view.removeFromSuperview() self.removeFromParent() - deregisterFromSystemEventChanges() + NotificationCenter.default.removeObserver(self) } } @@ -376,10 +376,6 @@ extension CoachMarksViewController { center.addObserver(self, selector: #selector(restoreAfterChangeDidComplete), name: UIApplication.didChangeStatusBarFrameNotification, object: nil) } - - func deregisterFromSystemEventChanges() { - NotificationCenter.default.removeObserver(self) - } } // MARK: - Private Extension: User Events diff --git a/Sources/Instructions/Core/Public/CoachMarksController.swift b/Sources/Instructions/Core/Public/CoachMarksController.swift index f3c0007a..d3afd883 100644 --- a/Sources/Instructions/Core/Public/CoachMarksController.swift +++ b/Sources/Instructions/Core/Public/CoachMarksController.swift @@ -5,6 +5,7 @@ import UIKit // MARK: - Main Class /// Handles a set of coach marks, and display them successively. +@MainActor public class CoachMarksController { // MARK: - Public properties /// Implement the data source protocol and supply diff --git a/Sources/Instructions/Extra/Default Views/CoachMarkBackgroundStyle.swift b/Sources/Instructions/Extra/Default Views/CoachMarkBackgroundStyle.swift index b1757cbc..b1991a83 100644 --- a/Sources/Instructions/Extra/Default Views/CoachMarkBackgroundStyle.swift +++ b/Sources/Instructions/Extra/Default Views/CoachMarkBackgroundStyle.swift @@ -3,6 +3,7 @@ import UIKit +@MainActor public protocol CoachMarkBackgroundStyle { var innerColor: UIColor { get set } var borderColor: UIColor { get set } @@ -10,6 +11,7 @@ public protocol CoachMarkBackgroundStyle { var highlightedBorderColor: UIColor { get set } } +@MainActor public protocol CoachMarkBodyBackgroundStyle: AnyObject, CoachMarkBackgroundStyle { var isHighlighted: Bool { get set } var cornerRadius: CGFloat { get set } diff --git a/Sources/Instructions/Extra/Internal/CoachMarkComponent.swift b/Sources/Instructions/Extra/Internal/CoachMarkComponent.swift index 868592c4..9c55e812 100644 --- a/Sources/Instructions/Extra/Internal/CoachMarkComponent.swift +++ b/Sources/Instructions/Extra/Internal/CoachMarkComponent.swift @@ -3,6 +3,7 @@ import UIKit +@MainActor protocol CoachMarkComponent { var frame: CGRect { get set } } diff --git a/Sources/Instructions/Helpers/Internal/CoachMarkInnerLayoutHelper.swift b/Sources/Instructions/Helpers/Internal/CoachMarkInnerLayoutHelper.swift index 75853866..1f8fce2d 100644 --- a/Sources/Instructions/Helpers/Internal/CoachMarkInnerLayoutHelper.swift +++ b/Sources/Instructions/Helpers/Internal/CoachMarkInnerLayoutHelper.swift @@ -3,6 +3,7 @@ import UIKit +@MainActor class CoachMarkInnerLayoutHelper { func horizontalArrowConstraints(for coachMarkViews: CoachMarkViews, withPosition position: ArrowPosition, diff --git a/Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.swift b/Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.swift index 67634d24..3eee234b 100644 --- a/Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.swift +++ b/Sources/Instructions/Helpers/Internal/CoachMarkLayoutHelper.swift @@ -3,7 +3,7 @@ import UIKit -class CoachMarkLayoutHelper { +@MainActor class CoachMarkLayoutHelper { var layoutDirection: UIUserInterfaceLayoutDirection = .leftToRight // TODO: Improve the layout system. Make it smarter. diff --git a/Sources/Instructions/Helpers/Public/CoachMarkHelper.swift b/Sources/Instructions/Helpers/Public/CoachMarkHelper.swift index b2150511..d3c34cba 100644 --- a/Sources/Instructions/Helpers/Public/CoachMarkHelper.swift +++ b/Sources/Instructions/Helpers/Public/CoachMarkHelper.swift @@ -3,7 +3,7 @@ import UIKit -public class CoachMarkHelper { +@MainActor public class CoachMarkHelper { let instructionsRootView: InstructionsRootView let flowManager: FlowManager diff --git a/Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift b/Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift index bb6213ce..cf1da916 100644 --- a/Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift +++ b/Sources/Instructions/Managers/Internal/CoachMarkDisplayManager.swift @@ -4,7 +4,7 @@ import UIKit /// This class deals with the layout of coach marks. -class CoachMarkDisplayManager { +@MainActor class CoachMarkDisplayManager { // MARK: - Public properties weak var dataSource: CoachMarksControllerProxyDataSource! weak var animationDelegate: CoachMarksControllerAnimationProxyDelegate? diff --git a/Sources/Instructions/Managers/Internal/OverlayStyleManager/BlurringOverlayStyleManager.swift b/Sources/Instructions/Managers/Internal/OverlayStyleManager/BlurringOverlayStyleManager.swift index e90cb169..81acf9a1 100644 --- a/Sources/Instructions/Managers/Internal/OverlayStyleManager/BlurringOverlayStyleManager.swift +++ b/Sources/Instructions/Managers/Internal/OverlayStyleManager/BlurringOverlayStyleManager.swift @@ -18,7 +18,7 @@ import UIKit /// /// TODO: Look for ways to improve everything, I'm fairly confident we can optimize /// a bunch of things. -class BlurringOverlayStyleManager: OverlayStyleManager { +@MainActor class BlurringOverlayStyleManager: OverlayStyleManager { // MARK: Properties weak var overlayView: OverlayView? { didSet { diff --git a/Sources/Instructions/Managers/Internal/OverlayStyleManager/OverlayStyleManager.swift b/Sources/Instructions/Managers/Internal/OverlayStyleManager/OverlayStyleManager.swift index 211b1f9f..122d06cd 100644 --- a/Sources/Instructions/Managers/Internal/OverlayStyleManager/OverlayStyleManager.swift +++ b/Sources/Instructions/Managers/Internal/OverlayStyleManager/OverlayStyleManager.swift @@ -6,6 +6,7 @@ import UIKit /// This protocol expected to be implemented by the CoachMarkController. /// A snapshottable object will return a snapshot view of its content. /// Useful when dealing with multiple windows. +@MainActor protocol Snapshottable: AnyObject { /// Returns: A snapshot of the view hierarchy. func snapshot() -> UIView? @@ -15,7 +16,7 @@ protocol Snapshottable: AnyObject { /// (Blurring the content behind, simple background color, etc.) /// Takes care of displaying and animating the overlay / cutout path (doesn't /// deals with the coach mark view itself). -protocol OverlayStyleManager: AnyObject { +@MainActor protocol OverlayStyleManager: AnyObject { /// The overlay managed by the styleManager. var overlayView: OverlayView? { get set } diff --git a/Sources/Instructions/Managers/Internal/SkipViewDisplayManager.swift b/Sources/Instructions/Managers/Internal/SkipViewDisplayManager.swift index d5d0416f..93af67f6 100644 --- a/Sources/Instructions/Managers/Internal/SkipViewDisplayManager.swift +++ b/Sources/Instructions/Managers/Internal/SkipViewDisplayManager.swift @@ -4,7 +4,7 @@ import UIKit /// This class deals with the layout of the "skip" view. -class SkipViewDisplayManager { +@MainActor class SkipViewDisplayManager { // MARK: - Internal properties /// Datasource providing the constraints to use. weak var dataSource: CoachMarksControllerProxyDataSource? diff --git a/Sources/Instructions/Managers/Public/FlowManager.swift b/Sources/Instructions/Managers/Public/FlowManager.swift index 4b32505b..7d41fdbd 100644 --- a/Sources/Instructions/Managers/Public/FlowManager.swift +++ b/Sources/Instructions/Managers/Public/FlowManager.swift @@ -3,7 +3,7 @@ import UIKit -public class FlowManager { +@MainActor public class FlowManager { // MARK: - Internal Properties /// `true` if coach marks are curently being displayed, `false` otherwise. public var isStarted: Bool { return currentIndex > -1 } @@ -294,13 +294,6 @@ public class FlowManager { showPreviousCoachMark(hidePrevious: true) } - - // MARK: Renamed Public Properties - @available(*, unavailable, renamed: "isStarted") - public var started: Bool = false - - @available(*, unavailable, renamed: "isPaused") - public var paused: Bool = false } extension FlowManager: CoachMarksViewControllerDelegate { diff --git a/Sources/Instructions/Managers/Public/OverlayManager.swift b/Sources/Instructions/Managers/Public/OverlayManager.swift index 6cd50caf..de3e25c3 100644 --- a/Sources/Instructions/Managers/Public/OverlayManager.swift +++ b/Sources/Instructions/Managers/Public/OverlayManager.swift @@ -5,7 +5,7 @@ import UIKit // Overlay a blocking view on top of the screen and handle the cutout path // around the point of interest. -public class OverlayManager { +@MainActor public class OverlayManager { // MARK: - Public properties /// The background color of the overlay public var backgroundColor: UIColor = InstructionsColor.overlay { @@ -186,19 +186,6 @@ public class OverlayManager { return translucentOverlayStyleManager } } - - // MARK: Renamed Public Properties - @available(*, unavailable, renamed: "backgroundColor") - public var color: UIColor = InstructionsColor.overlay - - @available(*, unavailable, renamed: "isUserInteractionEnabled") - public var allowTap: Bool = true - - @available(*, unavailable, renamed: "isUserInteractionEnabledInsideCutoutPath") - public var allowTouchInsideCutoutPath: Bool = false - - @available(*, unavailable, renamed: "areTouchEventsForwarded") - public var forwardTouchEvents: Bool = false } // swiftlint:disable class_delegate_protocol diff --git a/Sources/Instructions/Protocols and Enums/Internal/CoachMarkViewControllerDelegate.swift b/Sources/Instructions/Protocols and Enums/Internal/CoachMarkViewControllerDelegate.swift index 88ca8ab6..6b558a26 100644 --- a/Sources/Instructions/Protocols and Enums/Internal/CoachMarkViewControllerDelegate.swift +++ b/Sources/Instructions/Protocols and Enums/Internal/CoachMarkViewControllerDelegate.swift @@ -2,7 +2,7 @@ // Licensed under the terms of the MIT License. /// Used by the CoachMarksViewController to notify user or system related events. -protocol CoachMarksViewControllerDelegate: AnyObject { +@MainActor protocol CoachMarksViewControllerDelegate: AnyObject { /// The given `coachMarkView` was tapped. /// /// - Parameter coachMarkView: the view that was tapped. diff --git a/Sources/Instructions/Protocols and Enums/Public/CoachMarkArrowView.swift b/Sources/Instructions/Protocols and Enums/Public/CoachMarkArrowView.swift index 4ac03084..2eb6d9f5 100644 --- a/Sources/Instructions/Protocols and Enums/Public/CoachMarkArrowView.swift +++ b/Sources/Instructions/Protocols and Enums/Public/CoachMarkArrowView.swift @@ -4,6 +4,7 @@ import UIKit /// A protocol to which all the "arrow views" of a coach mark must conform. +@MainActor public protocol CoachMarkArrowView: AnyObject { /// A method to change the arrow highlighted state. /// If you feel the arrow should mirror the state of the "body view", diff --git a/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyHighlightArrowDelegate.swift b/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyHighlightArrowDelegate.swift index 5f342730..a1e98d2d 100644 --- a/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyHighlightArrowDelegate.swift +++ b/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyHighlightArrowDelegate.swift @@ -6,7 +6,7 @@ import UIKit /// Delegate the hilight mecanism of the arrow. This protocol is /// useful in case the whole body itself is the active control and /// we want the arrow to looks like it is part of this control. -public protocol CoachMarkBodyHighlightArrowDelegate: AnyObject { +@MainActor public protocol CoachMarkBodyHighlightArrowDelegate: AnyObject { /// Set wethe ror not the arrow should get in its /// highlighted state. diff --git a/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyView.swift b/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyView.swift index 2b835853..fe548726 100644 --- a/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyView.swift +++ b/Sources/Instructions/Protocols and Enums/Public/CoachMarkBodyView.swift @@ -4,6 +4,7 @@ import UIKit /// A protocol to which all the "body views" of a coach mark must conform. +@MainActor public protocol CoachMarkBodyView: AnyObject { /// The control that will trigger the change between the current coach mark /// and the next one. diff --git a/Sources/Instructions/Protocols and Enums/Public/CoachMarkSkipView.swift b/Sources/Instructions/Protocols and Enums/Public/CoachMarkSkipView.swift index 07670e65..0001cfb6 100644 --- a/Sources/Instructions/Protocols and Enums/Public/CoachMarkSkipView.swift +++ b/Sources/Instructions/Protocols and Enums/Public/CoachMarkSkipView.swift @@ -4,6 +4,7 @@ import UIKit /// A protocol to which all the "skip views" must conform. +@MainActor public protocol CoachMarkSkipView: AnyObject { /// The control that will trigger the stop, in the display flow. var skipControl: UIControl? { get } diff --git a/Sources/Instructions/Protocols and Enums/Public/CoachMarksControllerDataSource.swift b/Sources/Instructions/Protocols and Enums/Public/CoachMarksControllerDataSource.swift index 5f059482..868f7fba 100644 --- a/Sources/Instructions/Protocols and Enums/Public/CoachMarksControllerDataSource.swift +++ b/Sources/Instructions/Protocols and Enums/Public/CoachMarksControllerDataSource.swift @@ -5,6 +5,7 @@ import UIKit /// Describe how a coachmark datasource should behave. /// It works a bit like `UITableViewDataSource`. +@MainActor public protocol CoachMarksControllerDataSource: AnyObject { /// Asks for the number of coach marks to display. /// @@ -66,6 +67,7 @@ public extension CoachMarksControllerDataSource { } } +@MainActor internal protocol CoachMarksControllerProxyDataSource: AnyObject { /// Asks for the number of coach marks to display. /// diff --git a/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerAnimationDelegate.swift b/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerAnimationDelegate.swift index 3e78ce84..3430a174 100644 --- a/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerAnimationDelegate.swift +++ b/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerAnimationDelegate.swift @@ -4,7 +4,7 @@ import UIKit /// -public protocol CoachMarksControllerAnimationDelegate: AnyObject { +@MainActor public protocol CoachMarksControllerAnimationDelegate: AnyObject { func coachMarksController(_ coachMarksController: CoachMarksController, fetchAppearanceTransitionOfCoachMark coachMarkView: UIView, at index: Int, @@ -38,7 +38,7 @@ public extension CoachMarksControllerAnimationDelegate { using manager: CoachMarkAnimationManager) { } } -protocol CoachMarksControllerAnimationProxyDelegate: AnyObject { +@MainActor protocol CoachMarksControllerAnimationProxyDelegate: AnyObject { func fetchAppearanceTransition(OfCoachMark coachMarkView: UIView, at index: Int, using manager: CoachMarkTransitionManager) diff --git a/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerDelegate.swift b/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerDelegate.swift index defea48f..e8983606 100644 --- a/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerDelegate.swift +++ b/Sources/Instructions/Protocols and Enums/Public/Delegates/CoachMarksControllerDelegate.swift @@ -4,6 +4,7 @@ import UIKit /// Give a chance to react when coach marks are displayed +@MainActor public protocol CoachMarksControllerDelegate: AnyObject { func coachMarksController(_ coachMarksController: CoachMarksController, configureOrnamentsOfOverlay overlay: UIView) @@ -36,6 +37,7 @@ public protocol CoachMarksControllerDelegate: AnyObject { at index: Int) -> Bool } + public extension CoachMarksControllerDelegate { func coachMarksController(_ coachMarksController: CoachMarksController, configureOrnamentsOfOverlay overlay: UIView) { } @@ -82,6 +84,7 @@ public extension CoachMarksControllerDelegate { } } +@MainActor protocol CoachMarksControllerProxyDelegate: AnyObject { func configureOrnaments(ofOverlay: UIView)