Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
# Changelog

- please enter new entries in format
- please enter new entries in format

```
- <description> (#<PR_number>, kudos to @<author>)
```

## 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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

89 changes: 47 additions & 42 deletions Sources/ACKategories/Base/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Comment thread
olejnjak marked this conversation as resolved.

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)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Sources/ACKategories/UI/GradientView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
1 change: 1 addition & 0 deletions Sources/ACKategories/UI/Popup/PopupModalAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Foundation
import UIKit

/// Animation for presenting popups
@objc(ACKPopupModalAnimation)
public final class PopupModalAnimation: NSObject, UIViewControllerAnimatedTransitioning {

/// Popup horizontal inset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions Sources/PushNotifications/PushManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<UNNotificationSettings> { continuation in
notificationSettingsContinuation = continuation
Expand Down
Loading