diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b3f1daa..2e8fdc60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -- please enter new entries in format +- please enter new entries in format ``` - (#, kudos to @) @@ -8,6 +8,15 @@ ## Next +- Rename `Base.ViewController` to `BaseViewController` ([#155](https://github.com/AckeeCZ/ACKategories/pull/155), kudos to @komkovla) + - Add Objective-C name annotation `@objc(ACKBaseViewController)` for better Objective-C interoperability + - Add deprecated typealias `Base.ViewController` for backward compatibility + - Fix comment typo in `Base.viewControllerMemoryLoggingEnabled` +- Add `@objc(ACK...)` name annotations to all ObjC-visible public classes ([#155](https://github.com/AckeeCZ/ACKategories/pull/155)) + - `GradientView` → `@objc(ACKGradientView)` + - `PopupModalAnimation` → `@objc(ACKPopupModalAnimation)` + - `SelfSizingTableHeaderFooterView` → `@objc(ACKSelfSizingTableHeaderFooterView)` + - `PushManager` → `@objc(ACKPushManager)` - Update `font(_:lineHeight:textStyle:)` viewModifier to use native [`lineHeight`](https://developer.apple.com/documentation/swiftui/environmentvalues/lineheight) on +26.0 systems ([#154](https://github.com/AckeeCZ/ACKategories/pull/154), kudos to @olejnjak) ## 6.16.0 @@ -98,7 +107,7 @@ - Put `stop` of `childCoordinators` on main thread ([#103](https://github.com/AckeeCZ/ACKategories/pull/103), kudos to @IgorRosocha) -### Added +### Added - Add completion blocks to `UINavigationController` pop and push methods ([#101](https://github.com/AckeeCZ/ACKategories/pull/101), kudos to @olejnjak) - Add possibility to configure GradientView with public properties `colors` and `axis` even after init ([#104](https://github.com/AckeeCZ/ACKategories/pull/104), kudos to @janmisar) @@ -144,7 +153,7 @@ ### Fixed -- Encoding of primitive values ([#90](https://github.com/AckeeCZ/ACKategories/pull/90), kudos to @fortmarek) +- Encoding of primitive values ([#90](https://github.com/AckeeCZ/ACKategories/pull/90), kudos to @fortmarek) - `completion` of `Base.FlowCoordinator.stop()` is sometimes not called ([#94](https://github.com/AckeeCZ/ACKategories/pull/94), kudos to @lukashromadnik) ## 6.6.0 @@ -238,6 +247,6 @@ ## 6.0.2 - move from NSLog to unified logging (#39, kudos to @fortmarek) -- allow additional logic for isEmpty for collections (#40, kudos to @fortmarek) +- allow additional logic for isEmpty for collections (#40, kudos to @fortmarek) - add LICENSE file to Cocoapods source files diff --git a/Sources/ACKategories/Base/ViewController.swift b/Sources/ACKategories/Base/ViewController.swift index 3feda3d7..8012b97b 100644 --- a/Sources/ACKategories/Base/ViewController.swift +++ b/Sources/ACKategories/Base/ViewController.swift @@ -3,68 +3,73 @@ import UIKit import os.log extension Base { - /// Turn on/off logging of init/deinit of all VCs - /// ⚠️ Has no effect when Base.memoryLoggingEnabled is true + /// ⚠️ Has no effect when Base.memoryLoggingEnabled is false public static var viewControllerMemoryLoggingEnabled: Bool = true +} - /// Base class for all view controllers - open class ViewController: UIViewController { +extension Base { + @available(*, deprecated, message: "Use BaseViewController instead") + public typealias ViewController = BaseViewController +} - /// Navigation bar is shown/hidden in viewWillAppear according to this flag - open var hasNavigationBar: Bool = true +/// Base class for all view controllers +@objc(ACKBaseViewController) +open class BaseViewController: UIViewController { - public init() { - super.init(nibName: nil, bundle: nil) + /// Navigation bar is shown/hidden in viewWillAppear according to this flag + open var hasNavigationBar: Bool = true - if Base.memoryLoggingEnabled && Base.viewControllerMemoryLoggingEnabled { - os_log("📱 👶 %@", log: Logger.lifecycleLog(), type: .info, self) - } - } + public init() { + super.init(nibName: nil, bundle: nil) - @available(*, unavailable) - required public init?(coder aDecoder: NSCoder) { - fatalError("init(coder:) has not been implemented") + if Base.memoryLoggingEnabled && Base.viewControllerMemoryLoggingEnabled { + os_log("📱 👶 %@", log: Logger.lifecycleLog(), type: .info, self) } + } - private var firstWillAppearOccurred = false + @available(*, unavailable) + required public init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } - override open func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) + private var firstWillAppearOccurred = false - if !firstWillAppearOccurred { - viewWillFirstAppear(animated) - firstWillAppearOccurred = true - } + override open func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) - navigationController?.setNavigationBarHidden(!hasNavigationBar, animated: animated) + if !firstWillAppearOccurred { + viewWillFirstAppear(animated) + firstWillAppearOccurred = true } - private var firstDidAppearOccurred = false + navigationController?.setNavigationBarHidden(!hasNavigationBar, animated: animated) + } - override open func viewDidAppear(_ animated: Bool) { - super.viewDidAppear(animated) + private var firstDidAppearOccurred = false - if !firstDidAppearOccurred { - viewDidFirstAppear(animated) - firstDidAppearOccurred = true - } - } + override open func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) - /// Method is called when `viewWillAppear(_:)` is called for the first time - open func viewWillFirstAppear(_ animated: Bool) { - // to be overridden + if !firstDidAppearOccurred { + viewDidFirstAppear(animated) + firstDidAppearOccurred = true } + } - /// Method is called when `viewDidAppear(_:)` is called for the first time - open func viewDidFirstAppear(_ animated: Bool) { - // to be overridden - } + /// Method is called when `viewWillAppear(_:)` is called for the first time + open func viewWillFirstAppear(_ animated: Bool) { + // to be overridden + } + + /// Method is called when `viewDidAppear(_:)` is called for the first time + open func viewDidFirstAppear(_ animated: Bool) { + // to be overridden + } - deinit { - if Base.memoryLoggingEnabled && Base.viewControllerMemoryLoggingEnabled { - os_log("📱 ⚰️ %@", log: Logger.lifecycleLog(), type: .info, self) - } + deinit { + if Base.memoryLoggingEnabled && Base.viewControllerMemoryLoggingEnabled { + os_log("📱 ⚰️ %@", log: Logger.lifecycleLog(), type: .info, self) } } } diff --git a/Sources/ACKategories/UI/GradientView.swift b/Sources/ACKategories/UI/GradientView.swift index 37b12872..d9dbcb70 100644 --- a/Sources/ACKategories/UI/GradientView.swift +++ b/Sources/ACKategories/UI/GradientView.swift @@ -7,6 +7,7 @@ import UIKit `[UIColor.white, UIColor.white.withAlphaComponent(0)]` */ +@objc(ACKGradientView) open class GradientView: UIView { override open class var layerClass: Swift.AnyClass { CAGradientLayer.self } diff --git a/Sources/ACKategories/UI/Popup/PopupModalAnimation.swift b/Sources/ACKategories/UI/Popup/PopupModalAnimation.swift index cb5c2b3e..4b2a19fb 100644 --- a/Sources/ACKategories/UI/Popup/PopupModalAnimation.swift +++ b/Sources/ACKategories/UI/Popup/PopupModalAnimation.swift @@ -3,6 +3,7 @@ import Foundation import UIKit /// Animation for presenting popups +@objc(ACKPopupModalAnimation) public final class PopupModalAnimation: NSObject, UIViewControllerAnimatedTransitioning { /// Popup horizontal inset diff --git a/Sources/ACKategories/UI/SelfSizingTableHeaderFooterView.swift b/Sources/ACKategories/UI/SelfSizingTableHeaderFooterView.swift index 2c83cf1e..91a36dea 100644 --- a/Sources/ACKategories/UI/SelfSizingTableHeaderFooterView.swift +++ b/Sources/ACKategories/UI/SelfSizingTableHeaderFooterView.swift @@ -2,6 +2,7 @@ import UIKit /// This view will autolayout its height, even when used as a tableHeaderView or tableFooterView. +@objc(ACKSelfSizingTableHeaderFooterView) open class SelfSizingTableHeaderFooterView: UITableViewHeaderFooterView { private enum Status { diff --git a/Sources/PushNotifications/PushManager.swift b/Sources/PushNotifications/PushManager.swift index 93452514..0d4b12c5 100644 --- a/Sources/PushNotifications/PushManager.swift +++ b/Sources/PushNotifications/PushManager.swift @@ -29,6 +29,7 @@ public extension PushManaging where Self: PushManagingActions { } @available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *) +@objc(ACKPushManager) public final class PushManager: NSObject, PushManaging, PushManagingActions { public private(set) lazy var notificationSettings = AsyncStream { continuation in notificationSettingsContinuation = continuation