diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index 7bb0ae9..3d09b35 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -708,7 +708,7 @@ PRODUCT_NAME = PTPopupWebView; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -783,7 +783,7 @@ SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/Pods/Pods.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/PTPopupWebView.podspec b/PTPopupWebView.podspec index b20e467..4f55aad 100644 --- a/PTPopupWebView.podspec +++ b/PTPopupWebView.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = "PTPopupWebView" - s.version = "0.4.0" + s.version = "0.4.2" s.summary = "Swift subclass of the UIView which provide Popup web view." s.homepage = "https://github.com/pjocprac/PTPopupWebView.git" s.license = 'MIT' diff --git a/Pod/Classes/PTPopupWebView.swift b/Pod/Classes/PTPopupWebView.swift index aeb2624..0eac3bc 100644 --- a/Pod/Classes/PTPopupWebView.swift +++ b/Pod/Classes/PTPopupWebView.swift @@ -241,11 +241,11 @@ open class PTPopupWebView : UIView { for buttonSetting in buttonSettings { let button = UIButton() button.titleLabel?.font = buttonSetting.font ?? style.buttonFont - button.setTitle(buttonSetting.title, for: UIControlState()) - button.setTitleColor(buttonSetting.foregroundColor ?? style.buttonForegroundColor, for: UIControlState()) + button.setTitle(buttonSetting.title, for: UIControl.State()) + button.setTitleColor(buttonSetting.foregroundColor ?? style.buttonForegroundColor, for: UIControl.State()) button.setTitleColor(buttonSetting.disabledColor ?? style.buttonDisabledColor, for: .disabled) button.backgroundColor = buttonSetting.backgroundColor ?? style.buttonBackgroundColor - button.setImage(buttonSetting.image, for: UIControlState()) + button.setImage(buttonSetting.image, for: UIControl.State()) // Forward/Back/Reload's initial state is disabled switch buttonSetting.type { @@ -271,29 +271,29 @@ open class PTPopupWebView : UIView { for i in 0 ..< buttons.count { let button = buttons[i] // Top/Bottom to container is 0 - for attribute in [NSLayoutAttribute.top, NSLayoutAttribute.bottom] { + for attribute in [NSLayoutConstraint.Attribute.top, NSLayoutConstraint.Attribute.bottom] { buttonContainer.addConstraint( NSLayoutConstraint( - item : button, attribute: attribute, relatedBy: NSLayoutRelation.equal, + item : button, attribute: attribute, relatedBy: NSLayoutConstraint.Relation.equal, toItem: buttonContainer, attribute: attribute, multiplier: 1.0, constant: 0.0) ) } // Leading constraint let leftItem = i == 0 ? buttonContainer : buttons[i - 1] - let leftAttribute = i == 0 ? NSLayoutAttribute.leading : NSLayoutAttribute.trailing + let leftAttribute = i == 0 ? NSLayoutConstraint.Attribute.leading : NSLayoutConstraint.Attribute.trailing buttonContainer.addConstraint( NSLayoutConstraint( - item : button, attribute: NSLayoutAttribute.leading, relatedBy: NSLayoutRelation.equal, + item : button, attribute: NSLayoutConstraint.Attribute.leading, relatedBy: NSLayoutConstraint.Relation.equal, toItem: leftItem, attribute: leftAttribute, multiplier: 1.0, constant: 0.0) ) // Trailing constraint let rightItem = i == buttons.count - 1 ? buttonContainer : buttons[i + 1] - let rightAttribute = i == buttons.count - 1 ? NSLayoutAttribute.trailing : NSLayoutAttribute.leading + let rightAttribute = i == buttons.count - 1 ? NSLayoutConstraint.Attribute.trailing : NSLayoutConstraint.Attribute.leading buttonContainer.addConstraint( NSLayoutConstraint( - item : button, attribute: NSLayoutAttribute.trailing, relatedBy: NSLayoutRelation.equal, + item : button, attribute: NSLayoutConstraint.Attribute.trailing, relatedBy: NSLayoutConstraint.Relation.equal, toItem: rightItem, attribute: rightAttribute, multiplier: 1.0, constant: 0.0) ) } @@ -304,8 +304,8 @@ open class PTPopupWebView : UIView { for i in 1 ..< buttons.count { buttonContainer.addConstraint( NSLayoutConstraint( - item : buttons[0], attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, - toItem: buttons[i], attribute: NSLayoutAttribute.width, multiplier: 1.0, constant: 0.0) + item : buttons[0], attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, + toItem: buttons[i], attribute: NSLayoutConstraint.Attribute.width, multiplier: 1.0, constant: 0.0) ) } @@ -316,8 +316,8 @@ open class PTPopupWebView : UIView { let diffWidth = baseWidth - calcContentWidth(buttons[i]) buttonContainer.addConstraint( NSLayoutConstraint( - item : buttons[0], attribute: NSLayoutAttribute.width, relatedBy: NSLayoutRelation.equal, - toItem: buttons[i], attribute: NSLayoutAttribute.width, multiplier: 1.0, constant: diffWidth) + item : buttons[0], attribute: NSLayoutConstraint.Attribute.width, relatedBy: NSLayoutConstraint.Relation.equal, + toItem: buttons[i], attribute: NSLayoutConstraint.Attribute.width, multiplier: 1.0, constant: diffWidth) ) } } @@ -328,18 +328,18 @@ open class PTPopupWebView : UIView { let bundle = Bundle(for: PTPopupWebViewButton.self) let image = UIImage(named: "close", in: bundle, compatibleWith: nil)?.withRenderingMode(.alwaysTemplate) - closeButton.setImage(image, for: UIControlState()) - closeButton.contentEdgeInsets = UIEdgeInsetsMake(8, 8, 8, 8) + closeButton.setImage(image, for: UIControl.State()) + closeButton.contentEdgeInsets = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8) closeButton.addTarget(self, action: #selector(PTPopupWebView.close), for: .touchUpInside) } // Web view webView.translatesAutoresizingMaskIntoConstraints = false webViewContainer.addSubview(webView) - for attribute in [NSLayoutAttribute.top, NSLayoutAttribute.leading, NSLayoutAttribute.bottom, NSLayoutAttribute.trailing] { + for attribute in [NSLayoutConstraint.Attribute.top, NSLayoutConstraint.Attribute.leading, NSLayoutConstraint.Attribute.bottom, NSLayoutConstraint.Attribute.trailing] { webViewContainer.addConstraint( NSLayoutConstraint( - item : webViewContainer, attribute: attribute, relatedBy: NSLayoutRelation.equal, + item : webViewContainer, attribute: attribute, relatedBy: NSLayoutConstraint.Relation.equal, toItem: webView, attribute: attribute, multiplier: 1.0, constant: 0.0) ) } @@ -469,7 +469,7 @@ open class PTPopupWebView : UIView { } /// Close popup view - open func close() { + @objc open func close() { if let delegate = delegate { // if delegate != nil (ex. when use PTPopupWebViewContoller) delegate.close() @@ -481,7 +481,7 @@ open class PTPopupWebView : UIView { } - internal func buttonTapped (_ sender: AnyObject) { + @objc internal func buttonTapped (_ sender: AnyObject) { if let button = sender as? UIButton, let index = buttons.index(of: button) { if index < buttonSettings.count { let buttonSetting = buttonSettings[index] diff --git a/Pod/Classes/PTPopupWebViewController.swift b/Pod/Classes/PTPopupWebViewController.swift index b52e52e..807be4f 100644 --- a/Pod/Classes/PTPopupWebViewController.swift +++ b/Pod/Classes/PTPopupWebViewController.swift @@ -13,7 +13,7 @@ import WebKit open class PTPopupWebViewController : UIViewController { public enum PTPopupWebViewControllerBackgroundStyle { // blur effect background - case blurEffect (UIBlurEffectStyle) + case blurEffect (UIBlurEffect.Style) // opacity background case opacity (UIColor?) // transparent background @@ -56,13 +56,13 @@ open class PTPopupWebViewController : UIViewController { open fileprivate(set) var popupDisappearStyle : PTPopupWebViewControllerTransitionStyle = .pop(0.3, true) fileprivate let attributes = [ - NSLayoutAttribute.top, - NSLayoutAttribute.left, - NSLayoutAttribute.bottom, - NSLayoutAttribute.right + NSLayoutConstraint.Attribute.top, + NSLayoutConstraint.Attribute.left, + NSLayoutConstraint.Attribute.bottom, + NSLayoutConstraint.Attribute.right ] - fileprivate var constraints : [NSLayoutAttribute : NSLayoutConstraint] = [:] + fileprivate var constraints : [NSLayoutConstraint.Attribute : NSLayoutConstraint] = [:] override open func loadView() { let bundle = Bundle(for: type(of: self)) @@ -97,7 +97,7 @@ open class PTPopupWebViewController : UIViewController { popupView.translatesAutoresizingMaskIntoConstraints = false for attribute in attributes { let constraint = NSLayoutConstraint( - item : contentView, attribute: attribute, relatedBy: NSLayoutRelation.equal, + item : contentView, attribute: attribute, relatedBy: NSLayoutConstraint.Relation.equal, toItem: popupView, attribute: attribute, multiplier: 1.0, constant: 0.0) contentView.addConstraint(constraint) constraints[attribute] = constraint @@ -121,7 +121,7 @@ open class PTPopupWebViewController : UIViewController { break case .fade (let duration): - UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {self.popupView.alpha = 1}, completion: nil) + UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: {self.popupView.alpha = 1}, completion: nil) case .slide(let direction, let duration, let damping): self.popupView.alpha = 1 @@ -135,10 +135,10 @@ open class PTPopupWebViewController : UIViewController { self.popupView.transform = CGAffineTransform(translationX: 0, y: 0) } if damping { - UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0, options: UIViewAnimationOptions(), animations: animations, completion: nil) + UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0, options: UIView.AnimationOptions(), animations: animations, completion: nil) } else { - UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: animations, completion: nil) + UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: animations, completion: nil) } case .spread (let duration): @@ -148,7 +148,7 @@ open class PTPopupWebViewController : UIViewController { CATransaction.setCompletionBlock({ self.popupView.layer.mask = nil }) - CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)) + CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)) let maskLayer = CALayer() maskLayer.backgroundColor = UIColor.white.cgColor @@ -176,10 +176,10 @@ open class PTPopupWebViewController : UIViewController { } if damping { - UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0, options: UIViewAnimationOptions(), animations: animations, completion: nil) + UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.75, initialSpringVelocity: 0, options: UIView.AnimationOptions(), animations: animations, completion: nil) } else { - UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: animations, completion: nil) + UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: animations, completion: nil) } } } @@ -273,7 +273,7 @@ extension PTPopupWebViewController : PTPopupWebViewDelegate { completion(true) case .fade (let duration): - UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: {self.popupView.alpha = 0}, completion: completion) + UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: {self.popupView.alpha = 0}, completion: completion) case .slide(let direction, let duration, let damping): let animations = { @@ -294,17 +294,17 @@ extension PTPopupWebViewController : PTPopupWebViewDelegate { } } UIView.animate( - withDuration: duration/3, delay: 0, options: UIViewAnimationOptions(), + withDuration: duration/3, delay: 0, options: UIView.AnimationOptions(), animations: springAnimations, completion: { completed in UIView.animate( - withDuration: duration * 2/3, delay: 0, options: UIViewAnimationOptions(), + withDuration: duration * 2/3, delay: 0, options: UIView.AnimationOptions(), animations: animations, completion: completion) }) } else { - UIView.animate(withDuration: duration, delay: 0, options: UIViewAnimationOptions(), animations: animations, completion: nil) + UIView.animate(withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: animations, completion: nil) } case .spread (let duration): @@ -312,7 +312,7 @@ extension PTPopupWebViewController : PTPopupWebViewDelegate { CATransaction.setCompletionBlock({ completion(true) }) - CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)) + CATransaction.setAnimationTimingFunction(CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)) let maskLayer = CALayer() maskLayer.backgroundColor = UIColor.white.cgColor @@ -336,13 +336,13 @@ extension PTPopupWebViewController : PTPopupWebViewDelegate { case .pop (let duration, let damping): if damping { UIView.animate( - withDuration: duration/3, delay: 0, options: UIViewAnimationOptions(), + withDuration: duration/3, delay: 0, options: UIView.AnimationOptions(), animations: { self.popupView.transform = CGAffineTransform(scaleX: 1.05, y: 1.05) }, completion: { completed in UIView.animate( - withDuration: duration * 2/3, delay: 0, options: UIViewAnimationOptions(), + withDuration: duration * 2/3, delay: 0, options: UIView.AnimationOptions(), animations: { self.popupView.transform = CGAffineTransform(scaleX: 0.0000001, y: 0.0000001) // if 0, no animation }, completion: completion) @@ -350,7 +350,7 @@ extension PTPopupWebViewController : PTPopupWebViewDelegate { } else { UIView.animate( - withDuration: duration, delay: 0, options: UIViewAnimationOptions(), + withDuration: duration, delay: 0, options: UIView.AnimationOptions(), animations: { self.popupView.transform = CGAffineTransform(scaleX: 0.0000001, y: 0.0000001) }, completion: completion) diff --git a/Pod/Classes/PTPopupWebViewStyle.swift b/Pod/Classes/PTPopupWebViewStyle.swift index 89dae15..6efb5f5 100644 --- a/Pod/Classes/PTPopupWebViewStyle.swift +++ b/Pod/Classes/PTPopupWebViewStyle.swift @@ -170,6 +170,6 @@ open class PTPopupWebViewControllerStyle : PTPopupWebViewStyle { let screenBounds = UIScreen.main.bounds let vMargin = screenBounds.height * 0.1 let hMargin = screenBounds.width * 0.05 - outerMargin = UIEdgeInsetsMake(vMargin, hMargin, vMargin, hMargin) + outerMargin = UIEdgeInsets(top: vMargin, left: hMargin, bottom: vMargin, right: hMargin) } }