diff --git a/PKHUD.xcodeproj/project.pbxproj b/PKHUD.xcodeproj/project.pbxproj index 006cf8a..4e7251d 100644 --- a/PKHUD.xcodeproj/project.pbxproj +++ b/PKHUD.xcodeproj/project.pbxproj @@ -31,7 +31,6 @@ F996324F19514FEF001F73CA /* PKHUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = F996324819514FEF001F73CA /* PKHUD.swift */; }; F996325019514FEF001F73CA /* FrameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F996324919514FEF001F73CA /* FrameView.swift */; }; F996325219514FEF001F73CA /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = F996324B19514FEF001F73CA /* Window.swift */; }; - F996325319514FEF001F73CA /* WindowRootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F996324C19514FEF001F73CA /* WindowRootViewController.swift */; }; F996325519514FF3001F73CA /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F996325419514FF3001F73CA /* Images.xcassets */; }; F996325919515052001F73CA /* DemoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F996325819515052001F73CA /* DemoViewController.swift */; }; /* End PBXBuildFile section */ @@ -109,7 +108,6 @@ F996324819514FEF001F73CA /* PKHUD.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUD.swift; sourceTree = ""; }; F996324919514FEF001F73CA /* FrameView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FrameView.swift; sourceTree = ""; }; F996324B19514FEF001F73CA /* Window.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Window.swift; sourceTree = ""; }; - F996324C19514FEF001F73CA /* WindowRootViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowRootViewController.swift; sourceTree = ""; }; F996325419514FF3001F73CA /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; F996325819515052001F73CA /* DemoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -245,7 +243,6 @@ children = ( F996324919514FEF001F73CA /* FrameView.swift */, F996324B19514FEF001F73CA /* Window.swift */, - F996324C19514FEF001F73CA /* WindowRootViewController.swift */, ); name = Internal; sourceTree = ""; @@ -439,7 +436,6 @@ 640011571C5B6C080013F32B /* HUD.swift in Sources */, 3097AF3A1C4843AE007DD42B /* PKHUDRotatingImageView.swift in Sources */, F935B1611B2B8C8E003C3734 /* PKHUDTextView.swift in Sources */, - F996325319514FEF001F73CA /* WindowRootViewController.swift in Sources */, F908BEC31BB84D0B0015E5A8 /* PKHUDAnimating.swift in Sources */, F908BEC81BB85EA70015E5A8 /* PKHUDProgressView.swift in Sources */, F908BEC01BB849290015E5A8 /* PKHUDSuccessView.swift in Sources */, diff --git a/PKHUD/FrameView.swift b/PKHUD/FrameView.swift index 787f72e..062ea0b 100644 --- a/PKHUD/FrameView.swift +++ b/PKHUD/FrameView.swift @@ -1,5 +1,5 @@ // -// HUDView.swift +// FrameView.swift // PKHUD // // Created by Philip Kluz on 6/16/14. @@ -10,7 +10,7 @@ import UIKit /// Provides the general look and feel of the PKHUD, into which the eventual content is inserted. -internal class FrameView: UIVisualEffectView { +internal final class FrameView: UIVisualEffectView { internal init() { super.init(effect: UIBlurEffect(style: .light)) @@ -22,7 +22,7 @@ internal class FrameView: UIVisualEffectView { commonInit() } - fileprivate func commonInit() { + private func commonInit() { backgroundColor = UIColor(white: 0.8, alpha: 0.36) layer.cornerRadius = 9.0 layer.masksToBounds = true @@ -45,7 +45,7 @@ internal class FrameView: UIVisualEffectView { addMotionEffect(group) } - fileprivate var _content = UIView() + private var _content = UIView() internal var content: UIView { get { return _content diff --git a/PKHUD/HUD.swift b/PKHUD/HUD.swift index 50a42eb..b1cea87 100644 --- a/PKHUD/HUD.swift +++ b/PKHUD/HUD.swift @@ -91,7 +91,7 @@ public final class HUD { } // MARK: Private methods - fileprivate static func contentView(_ content: HUDContentType) -> UIView { + private static func contentView(_ content: HUDContentType) -> UIView { switch content { case .success: return PKHUDSuccessView() diff --git a/PKHUD/PKHUD.swift b/PKHUD/PKHUD.swift index acfc901..36d7360 100644 --- a/PKHUD/PKHUD.swift +++ b/PKHUD/PKHUD.swift @@ -12,17 +12,17 @@ import UIKit /// The PKHUD object controls showing and hiding of the HUD, as well as its contents and touch response behavior. open class PKHUD: NSObject { - fileprivate struct Constants { + private struct Constants { static let sharedHUD = PKHUD() } public var viewToPresentOn: UIView? - fileprivate let container = ContainerView() - fileprivate var hideTimer: Timer? + private let container = Window() + private var hideTimer: Timer? public typealias TimerAction = (Bool) -> Void - fileprivate var timerActions = [String: TimerAction]() + private var timerActions = [String: TimerAction]() /// Grace period is the time (in seconds) that the invoked method may be run without /// showing the HUD. If the task finishes before the grace time runs out, the HUD will @@ -45,7 +45,7 @@ open class PKHUD: NSObject { /// This may be used to prevent HUD display for very short tasks. /// Defaults to 0 (no grace time). public var gracePeriod: TimeInterval = 0 - fileprivate var graceTimer: Timer? + private var graceTimer: Timer? // MARK: Public @@ -149,7 +149,7 @@ open class PKHUD: NSObject { } } - func showContent() { + private func showContent() { graceTimer?.invalidate() container.showFrameView() startAnimatingContentView() @@ -187,13 +187,13 @@ open class PKHUD: NSObject { self.startAnimatingContentView() } - internal func startAnimatingContentView() { + private func startAnimatingContentView() { if let animatingContentView = contentView as? PKHUDAnimating, isVisible { animatingContentView.startAnimation() } } - internal func stopAnimatingContentView() { + private func stopAnimatingContentView() { if let animatingContentView = contentView as? PKHUDAnimating { animatingContentView.stopAnimation?() } diff --git a/PKHUD/PKHUDAssets.swift b/PKHUD/PKHUDAssets.swift index 2ecc43f..4833c13 100644 --- a/PKHUD/PKHUDAssets.swift +++ b/PKHUD/PKHUDAssets.swift @@ -17,7 +17,7 @@ open class PKHUDAssets: NSObject { open class var progressActivityImage: UIImage { return PKHUDAssets.bundledImage(named: "progress_activity") } open class var progressCircularImage: UIImage { return PKHUDAssets.bundledImage(named: "progress_circular") } - internal class func bundledImage(named name: String) -> UIImage { + private class func bundledImage(named name: String) -> UIImage { let primaryBundle = Bundle(for: PKHUDAssets.self) if let image = UIImage(named: name, in: primaryBundle, compatibleWith: nil) { // Load image in cases where PKHUD is directly integrated diff --git a/PKHUD/PKHUDErrorView.swift b/PKHUD/PKHUDErrorView.swift index d53bb05..69e1d2b 100644 --- a/PKHUD/PKHUDErrorView.swift +++ b/PKHUD/PKHUDErrorView.swift @@ -12,8 +12,8 @@ import UIKit /// PKHUDErrorView provides an animated error (cross) view. open class PKHUDErrorView: PKHUDSquareBaseView, PKHUDAnimating { - var dashOneLayer = PKHUDErrorView.generateDashLayer() - var dashTwoLayer = PKHUDErrorView.generateDashLayer() + private var dashOneLayer = PKHUDErrorView.generateDashLayer() + private var dashTwoLayer = PKHUDErrorView.generateDashLayer() class func generateDashLayer() -> CAShapeLayer { let dash = CAShapeLayer() @@ -57,7 +57,7 @@ open class PKHUDErrorView: PKHUDSquareBaseView, PKHUDAnimating { dashTwoLayer.position = layer.position } - func rotationAnimation(_ angle: CGFloat) -> CABasicAnimation { + private func rotationAnimation(_ angle: CGFloat) -> CABasicAnimation { var animation: CABasicAnimation if #available(iOS 9.0, *) { let springAnimation = CASpringAnimation(keyPath: "transform.rotation.z") diff --git a/PKHUD/PKHUDSystemActivityIndicatorView.swift b/PKHUD/PKHUDSystemActivityIndicatorView.swift index bba3df5..f66e625 100644 --- a/PKHUD/PKHUDSystemActivityIndicatorView.swift +++ b/PKHUD/PKHUDSystemActivityIndicatorView.swift @@ -27,7 +27,7 @@ public final class PKHUDSystemActivityIndicatorView: PKHUDSquareBaseView, PKHUDA commonInit() } - func commonInit () { + private func commonInit () { backgroundColor = UIColor.clear alpha = 0.8 diff --git a/PKHUD/PKHUDTextView.swift b/PKHUD/PKHUDTextView.swift index 5dc5055..8990aeb 100644 --- a/PKHUD/PKHUDTextView.swift +++ b/PKHUD/PKHUDTextView.swift @@ -22,7 +22,7 @@ open class PKHUDTextView: PKHUDWideBaseView { commonInit("") } - func commonInit(_ text: String?) { + private func commonInit(_ text: String?) { titleLabel.text = text addSubview(titleLabel) } diff --git a/PKHUD/Window.swift b/PKHUD/Window.swift index a880b84..cd8675f 100644 --- a/PKHUD/Window.swift +++ b/PKHUD/Window.swift @@ -1,5 +1,5 @@ // -// HUDWindow.swift +// Window.swift // PKHUD // // Created by Philip Kluz on 6/16/14. @@ -10,7 +10,7 @@ import UIKit /// The window used to display the PKHUD within. Placed atop the applications main window. -internal class ContainerView: UIView { +internal final class Window: UIView { private var keyboardIsVisible = false private var keyboardHeight: CGFloat = 0.0 @@ -28,7 +28,7 @@ internal class ContainerView: UIView { commonInit() } - fileprivate func commonInit() { + private func commonInit() { backgroundColor = UIColor.clear isHidden = true @@ -52,7 +52,7 @@ internal class ContainerView: UIView { isHidden = false } - fileprivate var willHide = false + private var willHide = false internal func hideFrameView(animated anim: Bool, completion: ((Bool) -> Void)? = nil) { let finalize: (_ finished: Bool) -> Void = { finished in @@ -80,7 +80,7 @@ internal class ContainerView: UIView { } } - fileprivate let backgroundView: UIView = { + private let backgroundView: UIView = { let view = UIView() view.backgroundColor = UIColor(white: 0.0, alpha: 0.25) view.alpha = 0.0 diff --git a/PKHUD/WindowRootViewController.swift b/PKHUD/WindowRootViewController.swift deleted file mode 100644 index 2e6d610..0000000 --- a/PKHUD/WindowRootViewController.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// PKHUD.WindowRootViewController.swift -// PKHUD -// -// Created by Philip Kluz on 6/18/14. -// Copyright (c) 2016 NSExceptional. All rights reserved. -// Licensed under the MIT license. -// - -import UIKit - -/// Serves as a configuration relay controller, tapping into the main window's rootViewController settings. -internal class WindowRootViewController: UIViewController { - - internal override var supportedInterfaceOrientations: UIInterfaceOrientationMask { - if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController { - return rootViewController.supportedInterfaceOrientations - } else { - return UIInterfaceOrientationMask.portrait - } - } - - internal override var preferredStatusBarStyle: UIStatusBarStyle { - return self.presentingViewController?.preferredStatusBarStyle ?? UIApplication.shared.statusBarStyle - } - - internal override var prefersStatusBarHidden: Bool { - return self.presentingViewController?.prefersStatusBarHidden ?? UIApplication.shared.isStatusBarHidden - } - - internal override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { - if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController { - return rootViewController.preferredStatusBarUpdateAnimation - } else { - return .none - } - } - - internal override var shouldAutorotate: Bool { - if let rootViewController = UIApplication.shared.delegate?.window??.rootViewController { - return rootViewController.shouldAutorotate - } else { - return false - } - } -}