diff --git a/Example/CocoaBar Example.xcodeproj/project.pbxproj b/Example/CocoaBar Example.xcodeproj/project.pbxproj index dac7566..a341516 100644 --- a/Example/CocoaBar Example.xcodeproj/project.pbxproj +++ b/Example/CocoaBar Example.xcodeproj/project.pbxproj @@ -231,12 +231,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0900; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = "Merrick Sapsford"; TargetAttributes = { 4628CF1B1CF34B8F00B4F4A8 = { CreatedOnToolsVersion = 7.3.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 1010; }; }; }; @@ -314,12 +314,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -351,7 +353,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -368,12 +370,14 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -398,7 +402,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; VALIDATE_PRODUCT = YES; }; name = Release; @@ -411,7 +415,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.CocoaBar-Example"; PRODUCT_NAME = Example; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -424,7 +429,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.msapsford.CocoaBar-Example"; PRODUCT_NAME = Example; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = Default; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Example/CocoaBar Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/CocoaBar Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Example/CocoaBar Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json b/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json index f3fb302..6e2d575 100644 --- a/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", @@ -34,6 +44,16 @@ "filename" : "Icon-60@3x.png", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -71,6 +91,12 @@ "idiom" : "ipad", "filename" : "Icon.png", "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon 1024.png", + "scale" : "1x" } ], "info" : { diff --git a/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Icon 1024.png b/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Icon 1024.png new file mode 100644 index 0000000..9eb2dff Binary files /dev/null and b/Example/CocoaBar Example/Resource/Assets.xcassets/AppIcon.appiconset/Icon 1024.png differ diff --git a/Example/CocoaBar Example/Source/AppDelegate.swift b/Example/CocoaBar Example/Source/AppDelegate.swift index ea404b3..2e0335d 100644 --- a/Example/CocoaBar Example/Source/AppDelegate.swift +++ b/Example/CocoaBar Example/Source/AppDelegate.swift @@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? var cocoaBar: CocoaBar? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. window?.makeKey() diff --git a/Example/CocoaBar Example/Source/UI/Screens/ViewController.swift b/Example/CocoaBar Example/Source/UI/Screens/ViewController.swift index b363ce1..7580f16 100644 --- a/Example/CocoaBar Example/Source/UI/Screens/ViewController.swift +++ b/Example/CocoaBar Example/Source/UI/Screens/ViewController.swift @@ -66,7 +66,7 @@ class ViewController: UIViewController, UITableViewDataSource, UITableViewDelega self.gradientView?.colors = [UIColor.purple, UIColor(red: 29, green: 0, blue: 174)] - self.tableView?.rowHeight = UITableViewAutomaticDimension + self.tableView?.rowHeight = UITableView.automaticDimension self.tableView?.estimatedRowHeight = 96.0 self.tableView?.reloadData() } diff --git a/Sources/CocoaBar.swift b/Sources/CocoaBar.swift index 924c4c5..d2bd7e8 100644 --- a/Sources/CocoaBar.swift +++ b/Sources/CocoaBar.swift @@ -262,7 +262,7 @@ public class CocoaBar: UIView, CocoaBarLayoutDelegate { object: nil) notificationCenter.addObserver(self, selector: #selector(self.windowDidBecomeVisible(_:)), - name: NSNotification.Name.UIWindowDidBecomeVisible, + name: UIWindow.didBecomeVisibleNotification, object: nil) } @@ -331,7 +331,7 @@ public class CocoaBar: UIView, CocoaBarLayoutDelegate { private func bringBarToFront() { if let displayWindow = self.displayWindow { - displayWindow.bringSubview(toFront: self) + displayWindow.bringSubviewToFront(self) } } @@ -478,7 +478,7 @@ public class CocoaBar: UIView, CocoaBarLayoutDelegate { self.isAnimating = true UIView.animate(withDuration: 0.2, delay: 0.0, - options: UIViewAnimationOptions.curveEaseOut, + options: UIView.AnimationOptions.curveEaseOut, animations: { self.superview?.layoutIfNeeded() @@ -540,7 +540,7 @@ public class CocoaBar: UIView, CocoaBarLayoutDelegate { self.layout.hideShadowAnimated(animated) UIView.animate(withDuration: 0.2, delay: 0.0, - options: UIViewAnimationOptions.curveEaseIn, + options: UIView.AnimationOptions.curveEaseIn, animations: { self.superview?.layoutIfNeeded() diff --git a/Sources/CocoaBarLayout.swift b/Sources/CocoaBarLayout.swift index 3ff9a5b..05b10ad 100644 --- a/Sources/CocoaBarLayout.swift +++ b/Sources/CocoaBarLayout.swift @@ -110,7 +110,7 @@ open class CocoaBarLayout: DropShadowView { if let dismissButton = newValue { dismissButton.addTarget(self, action: #selector(closeButtonPressed), - for: UIControlEvents.touchUpInside) + for: UIControl.Event.touchUpInside) } } } @@ -123,7 +123,7 @@ open class CocoaBarLayout: DropShadowView { if let actionButton = newValue { actionButton.addTarget(self, action: #selector(actionButtonPressed), - for: UIControlEvents.touchUpInside) + for: UIControl.Event.touchUpInside) } } } @@ -284,10 +284,10 @@ open class CocoaBarLayout: DropShadowView { case .blurLight, .blurDark: self.backgroundColor = UIColor.clear - var style: UIBlurEffectStyle + var style: UIBlurEffect.Style switch newStyle { - case .blurDark: style = UIBlurEffectStyle.dark - default: style = UIBlurEffectStyle.extraLight + case .blurDark: style = UIBlurEffect.Style.dark + default: style = UIBlurEffect.Style.extraLight } // add blur view diff --git a/Sources/Layouts/CocoaBarActionLayout.swift b/Sources/Layouts/CocoaBarActionLayout.swift index 945717b..89b57a9 100644 --- a/Sources/Layouts/CocoaBarActionLayout.swift +++ b/Sources/Layouts/CocoaBarActionLayout.swift @@ -33,11 +33,11 @@ public class CocoaBarActionLayout: CocoaBarLayout { switch newStyle { case .blurDark: self.titleLabel?.textColor = UIColor.white - self.actionButton?.setTitleColor(UIColor.lightText, for: UIControlState()) + self.actionButton?.setTitleColor(UIColor.lightText, for: UIControl.State()) self.activityIndicator?.color = UIColor.white default: self.titleLabel?.textColor = UIColor.black - self.actionButton?.setTitleColor(self.tintColor, for: UIControlState()) + self.actionButton?.setTitleColor(self.tintColor, for: UIControl.State()) self.activityIndicator?.color = UIColor.darkGray } } diff --git a/Sources/Layouts/CocoaBarDefaultLayout.swift b/Sources/Layouts/CocoaBarDefaultLayout.swift index 2a3e4d7..d189cea 100644 --- a/Sources/Layouts/CocoaBarDefaultLayout.swift +++ b/Sources/Layouts/CocoaBarDefaultLayout.swift @@ -30,10 +30,10 @@ public class CocoaBarDefaultLayout: CocoaBarLayout { switch newStyle { case .blurDark: self.titleLabel?.textColor = UIColor.white - self.dismissButton?.setTitleColor(UIColor.lightText, for: UIControlState()) + self.dismissButton?.setTitleColor(UIColor.lightText, for: UIControl.State()) default: self.titleLabel?.textColor = UIColor.black - self.dismissButton?.setTitleColor(self.tintColor, for: UIControlState()) + self.dismissButton?.setTitleColor(self.tintColor, for: UIControl.State()) } } diff --git a/Sources/Layouts/CocoaBarSubtitleLayout.swift b/Sources/Layouts/CocoaBarSubtitleLayout.swift index b3b1c8e..1537d90 100644 --- a/Sources/Layouts/CocoaBarSubtitleLayout.swift +++ b/Sources/Layouts/CocoaBarSubtitleLayout.swift @@ -30,11 +30,11 @@ public class CocoaBarSubtitleLayout: CocoaBarLayout { case .blurDark: self.titleLabel?.textColor = UIColor.white self.subtitleLabel?.textColor = UIColor.white - self.dismissButton?.setTitleColor(UIColor.lightText, for: UIControlState()) + self.dismissButton?.setTitleColor(UIColor.lightText, for: UIControl.State()) default: self.titleLabel?.textColor = UIColor.black self.subtitleLabel?.textColor = UIColor.black - self.dismissButton?.setTitleColor(self.tintColor, for: UIControlState()) + self.dismissButton?.setTitleColor(self.tintColor, for: UIControl.State()) } } diff --git a/Sources/Utilities/AutoLayoutUtils.swift b/Sources/Utilities/AutoLayoutUtils.swift index f5ab3a5..db458a7 100644 --- a/Sources/Utilities/AutoLayoutUtils.swift +++ b/Sources/Utilities/AutoLayoutUtils.swift @@ -22,11 +22,11 @@ internal extension UIView { var constraints = [NSLayoutConstraint]() constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: horizontalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: verticalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) self.superview?.addConstraints(constraints) @@ -44,11 +44,11 @@ internal extension UIView { var constraints = [NSLayoutConstraint]() constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: horizontalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: verticalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) self.superview?.addConstraints(constraints) @@ -66,11 +66,11 @@ internal extension UIView { var constraints = [NSLayoutConstraint]() constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: horizontalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: verticalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) self.superview?.addConstraints(constraints) @@ -89,11 +89,11 @@ internal extension UIView { var constraints = [NSLayoutConstraint]() constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: verticalConstraints, - options: NSLayoutFormatOptions(rawValue: 0), + options: NSLayoutConstraint.FormatOptions(rawValue: 0), metrics: nil, views: views)) constraints.append(contentsOf: NSLayoutConstraint.constraints(withVisualFormat: centerHorizontalConstraints, - options: NSLayoutFormatOptions.alignAllCenterX, + options: NSLayoutConstraint.FormatOptions.alignAllCenterX, metrics: nil, views: views)) @@ -107,10 +107,10 @@ internal extension UIView { @discardableResult internal func cb_autoSetHeight(_ height: Float) -> NSLayoutConstraint? { if self.setUpForAutoLayout() != nil { let constraint = NSLayoutConstraint(item: self, - attribute: NSLayoutAttribute.height, - relatedBy: NSLayoutRelation.equal, + attribute: NSLayoutConstraint.Attribute.height, + relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, - attribute: NSLayoutAttribute.notAnAttribute, + attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1.0, constant: CGFloat(height)) self.superview?.addConstraint(constraint) @@ -122,10 +122,10 @@ internal extension UIView { @discardableResult internal func cb_autoSetWidth(_ width: Float) -> NSLayoutConstraint? { if self.setUpForAutoLayout() != nil { let constraint = NSLayoutConstraint(item: self, - attribute: NSLayoutAttribute.width, - relatedBy: NSLayoutRelation.equal, + attribute: NSLayoutConstraint.Attribute.width, + relatedBy: NSLayoutConstraint.Relation.equal, toItem: nil, - attribute: NSLayoutAttribute.notAnAttribute, + attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1.0, constant: CGFloat(width)) self.superview?.addConstraint(constraint)