Skip to content
This repository has been archived by the owner on Oct 6, 2019. It is now read-only.

added support for swift 4.2 #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
18 changes: 12 additions & 6 deletions Example/CocoaBar Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -351,7 +353,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -34,6 +44,16 @@
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down Expand Up @@ -71,6 +91,12 @@
"idiom" : "ipad",
"filename" : "Icon.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon 1024.png",
"scale" : "1x"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Example/CocoaBar Example/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/CocoaBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -331,7 +331,7 @@ public class CocoaBar: UIView, CocoaBarLayoutDelegate {

private func bringBarToFront() {
if let displayWindow = self.displayWindow {
displayWindow.bringSubview(toFront: self)
displayWindow.bringSubviewToFront(self)
}
}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions Sources/CocoaBarLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand All @@ -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)
}
}
}
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Sources/Layouts/CocoaBarActionLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Layouts/CocoaBarDefaultLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Layouts/CocoaBarSubtitleLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
28 changes: 14 additions & 14 deletions Sources/Utilities/AutoLayoutUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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))

Expand All @@ -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)

Expand All @@ -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)

Expand Down