Skip to content

Commit 078e682

Browse files
committed
Fixed protect level for controller extension.
1 parent df321b1 commit 078e682

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

Sources/SparrowKit/UIKit/Extensions/UIViewControllerExtension.swift

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
#if canImport(UIKit) && (os(iOS) || os(tvOS))
2323
import UIKit
2424

25-
public extension UIViewController {
26-
25+
extension UIViewController {
2726

2827
// MARK: - Containers
2928

@@ -32,7 +31,7 @@ public extension UIViewController {
3231

3332
- parameter prefersLargeTitles: A Boolean value indicating whether the title should be displayed in a large format..
3433
*/
35-
@objc func wrapToNavigationController(prefersLargeTitles: Bool) -> UINavigationController {
34+
@objc open func wrapToNavigationController(prefersLargeTitles: Bool) -> UINavigationController {
3635
let navigationController = UINavigationController(rootViewController: self)
3736
#if os(iOS)
3837
navigationController.navigationBar.prefersLargeTitles = prefersLargeTitles
@@ -46,7 +45,7 @@ public extension UIViewController {
4645
- parameter childController: Specific controller which using as child.
4746
- parameter containerView: Conteiner which using to add a view of child controller.
4847
*/
49-
func addChildWithView(_ childController: UIViewController, to containerView: UIView) {
48+
open func addChildWithView(_ childController: UIViewController, to containerView: UIView) {
5049
addChild(childController)
5150
containerView.addSubview(childController.view)
5251
childController.didMove(toParent: self)
@@ -57,22 +56,22 @@ public extension UIViewController {
5756
/**
5857
SparrowKit: Indicate if controller is loaded and presented.
5958
*/
60-
var isVisible: Bool {
59+
open var isVisible: Bool {
6160
return isViewLoaded && view.window != nil
6261
}
6362

6463
/**
6564
SparrowKit: Removed property `animated`, always `true`.
6665
*/
67-
func present(_ viewControllerToPresent: UIViewController, completion: (() -> Swift.Void)? = nil) {
66+
open func present(_ viewControllerToPresent: UIViewController, completion: (() -> Swift.Void)? = nil) {
6867
self.present(viewControllerToPresent, animated: true, completion: completion)
6968
}
7069

7170
/**
7271
SparrowKit: If scene name is same as
7372
*/
7473
@available(iOS 13, tvOS 13, *)
75-
func destruct(scene name: String) {
74+
open func destruct(scene name: String) {
7675
guard let session = view.window?.windowScene?.session else {
7776
dismissAnimated()
7877
return
@@ -87,7 +86,7 @@ public extension UIViewController {
8786
/**
8887
SparrowKit: Dismiss always animated.
8988
*/
90-
@objc func dismissAnimated() {
89+
@objc open func dismissAnimated() {
9190
self.dismiss(animated: true, completion: nil)
9291
}
9392

@@ -98,7 +97,7 @@ public extension UIViewController {
9897
*/
9998
#if os(iOS)
10099
@available(iOS 13, *)
101-
var closeBarButtonItem: UIBarButtonItem {
100+
open var closeBarButtonItem: UIBarButtonItem {
102101
if #available(iOS 14.0, *) {
103102
return UIBarButtonItem.init(systemItem: .close, primaryAction: .init(handler: { [weak self] (action) in
104103
self?.dismissAnimated()
@@ -118,7 +117,7 @@ public extension UIViewController {
118117
*/
119118
#if os(iOS)
120119
@available(iOS 14, *)
121-
func closeBarButtonItem(sceneName: String? = nil) -> UIBarButtonItem {
120+
open func closeBarButtonItem(sceneName: String? = nil) -> UIBarButtonItem {
122121
return UIBarButtonItem.init(systemItem: .close, primaryAction: .init(handler: { [weak self] (action) in
123122
guard let self = self else { return }
124123
if let name = sceneName {
@@ -136,7 +135,7 @@ public extension UIViewController {
136135
SparrowKit: Added gester which observe when tap need hide keyboard.
137136
Shoud add below of using views like textfuilds.
138137
*/
139-
func dismissKeyboardWhenTappedAround() {
138+
open func dismissKeyboardWhenTappedAround() {
140139
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboardTappedAround(_:)))
141140
tap.cancelsTouchesInView = false
142141
view.addGestureRecognizer(tap)
@@ -146,14 +145,14 @@ public extension UIViewController {
146145
SparrowKit: Internal method which process tap around for hide keyboard.
147146
No need call it manually.
148147
*/
149-
@objc func dismissKeyboardTappedAround(_ gestureRecognizer: UIPanGestureRecognizer) {
148+
@objc open func dismissKeyboardTappedAround(_ gestureRecognizer: UIPanGestureRecognizer) {
150149
dismissKeyboard()
151150
}
152151

153152
/**
154153
SparrowKit: Hide keyboard.
155154
*/
156-
func dismissKeyboard() {
155+
open func dismissKeyboard() {
157156
view.endEditing(true)
158157
}
159158
}

0 commit comments

Comments
 (0)