diff --git a/Gradient View.xcodeproj/project.pbxproj b/Gradient View.xcodeproj/project.pbxproj index 836f31d..4dfc1ac 100644 --- a/Gradient View.xcodeproj/project.pbxproj +++ b/Gradient View.xcodeproj/project.pbxproj @@ -284,7 +284,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = "Sam Soffes"; TargetAttributes = { 2163B9F51A25FBF000610B0C = { @@ -436,12 +436,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; @@ -493,12 +495,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; diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme index 4253501..93438f2 100644 --- a/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme +++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme index 6f152da..f88ccfd 100644 --- a/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme +++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/Example-tvOS.xcscheme @@ -1,6 +1,6 @@ @@ -46,7 +45,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-iOS.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-iOS.xcscheme index c6d17db..b113937 100644 --- a/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-iOS.xcscheme +++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-iOS.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-tvOS.xcscheme b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-tvOS.xcscheme index 483750c..9b2cd98 100644 --- a/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-tvOS.xcscheme +++ b/Gradient View.xcodeproj/xcshareddata/xcschemes/GradientView-tvOS.xcscheme @@ -1,6 +1,6 @@ @@ -37,7 +36,6 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/GradientView/GradientView.swift b/GradientView/GradientView.swift index 0541996..b22baf3 100644 --- a/GradientView/GradientView.swift +++ b/GradientView/GradientView.swift @@ -37,7 +37,7 @@ import UIKit /// An optional array of `UIColor` objects used to draw the gradient. If the value is `nil`, the `backgroundColor` /// will be drawn instead of a gradient. The default is `nil`. - open var colors: [UIColor]? { + @objc open var colors: [UIColor]? { didSet { updateGradient() } @@ -48,7 +48,7 @@ import UIKit /// things will happen. You must make sure the number of dimmed colors equals the number of regular colors. /// /// The default is `nil`. - open var dimmedColors: [UIColor]? { + @objc open var dimmedColors: [UIColor]? { didSet { updateGradient() } @@ -57,7 +57,7 @@ import UIKit /// Automatically dim gradient colors when prompted by the system (i.e. when an alert is shown). /// /// The default is `true`. - open var automaticallyDims: Bool = true + @objc open var automaticallyDims: Bool = true /// An optional array of `CGFloat`s defining the location of each gradient stop. /// @@ -65,7 +65,7 @@ import UIKit /// `nil`, the stops are spread uniformly across the range. /// /// Defaults to `nil`. - open var locations: [CGFloat]? { + @objc open var locations: [CGFloat]? { didSet { updateGradient() } @@ -199,13 +199,13 @@ import UIKit let colorSpace = CGColorSpaceCreateDeviceRGB() let colorSpaceModel = colorSpace.model - let gradientColors = colors.map { (color: UIColor) -> AnyObject! in + let gradientColors = colors.map { (color: UIColor) -> AnyObject in let cgColor = color.cgColor let cgColorSpace = cgColor.colorSpace ?? colorSpace // The color's color space is RGB, simply add it. if cgColorSpace.model == colorSpaceModel { - return cgColor as AnyObject! + return cgColor } // Convert to RGB. There may be a more efficient way to do this. @@ -214,7 +214,7 @@ import UIKit var green: CGFloat = 0 var alpha: CGFloat = 0 color.getRed(&red, green: &green, blue: &blue, alpha: &alpha) - return UIColor(red: red, green: green, blue: blue, alpha: alpha).cgColor as AnyObject! + return UIColor(red: red, green: green, blue: blue, alpha: alpha).cgColor } as NSArray gradient = CGGradient(colorsSpace: colorSpace, colors: gradientColors, locations: locations)