diff --git a/C4.xcodeproj/project.pbxproj b/C4.xcodeproj/project.pbxproj index 3feed7ad..f06e3193 100644 --- a/C4.xcodeproj/project.pbxproj +++ b/C4.xcodeproj/project.pbxproj @@ -218,6 +218,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 13470594239224A300B4BA4C /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = ""; }; 1F40C6FA1C82ADF0004AE1E7 /* Camera.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Camera.swift; sourceTree = ""; }; 1F754DCA1C48EE600036D39F /* ImageLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageLayer.swift; sourceTree = ""; }; 1F75FDE81C5B1FE700EB62C2 /* C4Loop.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = C4Loop.aif; sourceTree = ""; }; @@ -358,6 +359,7 @@ 614F823919DB5ED3001DF1D4 = { isa = PBXGroup; children = ( + 13470594239224A300B4BA4C /* Package.swift */, A9D4F66E1B534F9F00F937AB /* C4 */, A9596D271A054A960023323D /* Tests */, A96F505B1B5385A5002B3A46 /* C4App */, @@ -649,7 +651,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0900; - LastUpgradeCheck = 1000; + LastUpgradeCheck = 1120; ORGANIZATIONNAME = C4; TargetAttributes = { 610A6A4D1F928E1B003B841A = { @@ -662,23 +664,23 @@ }; 614F824219DB5ED3001DF1D4 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1120; }; 614F824D19DB5ED4001DF1D4 = { CreatedOnToolsVersion = 6.0; - LastSwiftMigration = 0900; + LastSwiftMigration = 1120; TestTargetID = A96F50591B5385A5002B3A46; }; A96F50591B5385A5002B3A46 = { CreatedOnToolsVersion = 6.4; DevelopmentTeam = 75C7KVJZ99; - LastSwiftMigration = 0900; + LastSwiftMigration = 1120; }; }; }; buildConfigurationList = 614F823D19DB5ED3001DF1D4 /* Build configuration list for PBXProject "C4" */; compatibilityVersion = "Xcode 8.0"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -1106,6 +1108,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1155,7 +1158,7 @@ SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1166,6 +1169,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -1206,7 +1210,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1229,6 +1233,7 @@ PRODUCT_NAME = C4; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1247,6 +1252,7 @@ PRODUCT_NAME = C4; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -1262,6 +1268,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.c4ios.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/C4App.app/C4App"; }; name = Debug; @@ -1275,6 +1282,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.c4ios.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/C4App.app/C4App"; }; name = Release; @@ -1293,6 +1301,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.c4ios.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -1308,6 +1317,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.c4ios.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/C4.xcodeproj/xcshareddata/xcschemes/C4-iOS.xcscheme b/C4.xcodeproj/xcshareddata/xcschemes/C4-iOS.xcscheme index 83e9f074..f16856ca 100644 --- a/C4.xcodeproj/xcshareddata/xcschemes/C4-iOS.xcscheme +++ b/C4.xcodeproj/xcshareddata/xcschemes/C4-iOS.xcscheme @@ -1,6 +1,6 @@ + + + + @@ -39,17 +48,6 @@ - - - - - - - - + + + + @@ -39,17 +48,6 @@ - - - - - - - - Point { public extension CGPoint { ///Initializes a CGPoint from a Point - public init(_ point: Point) { + init(_ point: Point) { self.init(x: CGFloat(point.x), y: CGFloat(point.y)) } } diff --git a/C4/Core/Rect.swift b/C4/Core/Rect.swift index ba0308fd..0edf2170 100644 --- a/C4/Core/Rect.swift +++ b/C4/Core/Rect.swift @@ -301,7 +301,7 @@ public func inset(_ r: Rect, dx: Double, dy: Double) -> Rect { // MARK: - Casting to CGRect public extension CGRect { /// Initializes a CGRect from a Rect - public init(_ rect: Rect) { + init(_ rect: Rect) { self.init(origin: CGPoint(rect.origin), size: CGSize(rect.size)) } } diff --git a/C4/Core/Size.swift b/C4/Core/Size.swift index 177fe286..c5b5fb55 100644 --- a/C4/Core/Size.swift +++ b/C4/Core/Size.swift @@ -169,7 +169,7 @@ public func <= (lhs: Size, rhs: Size) -> Bool { // MARK: - Casting to CGSize public extension CGSize { /// Initializes a new CGSize from a Size - public init(_ size: Size) { + init(_ size: Size) { self.init(width: CGFloat(size.width), height: CGFloat(size.height)) } } diff --git a/C4/UI/AudioPlayer.swift b/C4/UI/AudioPlayer.swift index aa48373f..de1efedb 100644 --- a/C4/UI/AudioPlayer.swift +++ b/C4/UI/AudioPlayer.swift @@ -48,7 +48,7 @@ public class AudioPlayer: NSObject, AVAudioPlayerDelegate { /// ```` public init?(_ name: String) { do { - try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) + try AVAudioSession.sharedInstance().setCategory(.playback) try AVAudioSession.sharedInstance().setActive(true) } catch { print("Couldn't set up AVAudioSession") diff --git a/C4/UI/Camera.swift b/C4/UI/Camera.swift index 3f62f6a1..c5a58603 100644 --- a/C4/UI/Camera.swift +++ b/C4/UI/Camera.swift @@ -66,7 +66,7 @@ public class Camera: View { previewLayer.backgroundColor = clear.cgColor previewLayer.videoGravity = AVLayerVideoGravity.resizeAspectFill - orientationObserver = on(event: NSNotification.Name.UIDeviceOrientationDidChange) { [unowned self] in + orientationObserver = on(event: UIDevice.orientationDidChangeNotification) { [unowned self] in self.updateOrientation() } } @@ -191,7 +191,7 @@ public class Camera: View { return image } - var orientation: UIImageOrientation + var orientation: UIImage.Orientation let shouldFlip = position == .front switch videoOrientation { diff --git a/C4/UI/Image+ColorAt.swift b/C4/UI/Image+ColorAt.swift index b7d40e3f..339c01a5 100644 --- a/C4/UI/Image+ColorAt.swift +++ b/C4/UI/Image+ColorAt.swift @@ -50,7 +50,7 @@ public extension Image { /// let color = img.color(at: Point()) /// ```` /// - parameter at: a Point. - public func color(at point: Point) -> Color { + func color(at point: Point) -> Color { guard bounds.contains(point) else { print("Point is outside the image bounds") diff --git a/C4/UI/Movie.swift b/C4/UI/Movie.swift index 83a9bb09..c9b308c9 100644 --- a/C4/UI/Movie.swift +++ b/C4/UI/Movie.swift @@ -142,7 +142,7 @@ public class Movie: View { /// - parameter filename: The name of the movie file included in your project. public convenience init?(_ filename: String) { do { - try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback) + try AVAudioSession.sharedInstance().setCategory(.playback) try AVAudioSession.sharedInstance().setActive(true) } catch { print("Couldn't set up AVAudioSession") @@ -225,7 +225,7 @@ public class Movie: View { print("The current movie's player is not properly initialized") return } - p.seek(to: CMTimeMake(0, 1)) + p.seek(to: CMTimeMake(value: 0, timescale: 1)) p.pause() } diff --git a/C4/UI/Shape.swift b/C4/UI/Shape.swift index d30fc591..e19d56d6 100644 --- a/C4/UI/Shape.swift +++ b/C4/UI/Shape.swift @@ -41,7 +41,7 @@ open class Shape: View { return nil } - let fillRule = shapeLayer.fillRule == kCAFillRuleNonZero ? CGPathFillRule.evenOdd : CGPathFillRule.winding + let fillRule = shapeLayer.fillRule == CAShapeLayerFillRule.nonZero ? CGPathFillRule.evenOdd : CGPathFillRule.winding if path.contains(point, using: fillRule, transform: CGAffineTransform.identity) { return self @@ -216,9 +216,9 @@ open class Shape: View { public var fillRule: FillRule { get { switch shapeLayer.fillRule { - case kCAFillRuleNonZero: + case .nonZero: return .nonZero - case kCAFillRuleEvenOdd: + case .evenOdd: return .evenOdd default: return .nonZero @@ -227,9 +227,9 @@ open class Shape: View { set(fillRule) { switch fillRule { case .nonZero: - shapeLayer.fillRule = kCAFillRuleNonZero + shapeLayer.fillRule = .nonZero case .evenOdd: - shapeLayer.fillRule = kCAFillRuleEvenOdd + shapeLayer.fillRule = .evenOdd } } } @@ -275,9 +275,9 @@ open class Shape: View { public var lineCap: LineCap { get { switch shapeLayer.lineCap { - case kCALineCapRound: + case .round: return .round - case kCALineCapSquare: + case .square: return .square default: return .butt @@ -286,11 +286,11 @@ open class Shape: View { set(lineCap) { switch lineCap { case .butt: - shapeLayer.lineCap = kCALineCapButt + shapeLayer.lineCap = .butt case .round: - shapeLayer.lineCap = kCALineCapRound + shapeLayer.lineCap = .round case .square: - shapeLayer.lineCap = kCALineCapSquare + shapeLayer.lineCap = .square } } } @@ -299,9 +299,9 @@ open class Shape: View { public var lineJoin: LineJoin { get { switch shapeLayer.lineJoin { - case kCALineJoinRound: + case .round: return .round - case kCALineJoinBevel: + case .bevel: return .bevel default: return .miter @@ -310,11 +310,11 @@ open class Shape: View { set(lineJoin) { switch lineJoin { case .miter: - shapeLayer.lineJoin = kCALineJoinMiter + shapeLayer.lineJoin = .miter case .round: - shapeLayer.lineJoin = kCALineJoinRound + shapeLayer.lineJoin = .round case .bevel: - shapeLayer.lineJoin = kCALineJoinBevel + shapeLayer.lineJoin = .bevel } } } diff --git a/C4/UI/ShapeLayer.swift b/C4/UI/ShapeLayer.swift index fada523a..fdfe9755 100644 --- a/C4/UI/ShapeLayer.swift +++ b/C4/UI/ShapeLayer.swift @@ -132,7 +132,7 @@ extension CABasicAnimation { self.autoreverses = animation.autoreverses self.repeatCount = Float(animation.repeatCount) } - self.fillMode = kCAFillModeBoth + self.fillMode = .both self.isRemovedOnCompletion = false } } diff --git a/C4/UI/StoredAnimation.swift b/C4/UI/StoredAnimation.swift index b05f9f7f..aecee79f 100644 --- a/C4/UI/StoredAnimation.swift +++ b/C4/UI/StoredAnimation.swift @@ -34,21 +34,21 @@ public class StoredAnimation: Animation { let disable = ShapeLayer.disableActions ShapeLayer.disableActions = false var timing: CAMediaTimingFunction - var options: UIViewAnimationOptions = [UIViewAnimationOptions.beginFromCurrentState] + var options: UIView.AnimationOptions = [.beginFromCurrentState] switch curve { case .linear: options = [options, .curveLinear] - timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + timing = CAMediaTimingFunction(name: .linear) case .easeOut: options = [options, .curveEaseOut] - timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) + timing = CAMediaTimingFunction(name: .easeOut) case .easeIn: options = [options, .curveEaseIn] - timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) + timing = CAMediaTimingFunction(name: .easeIn) case .easeInOut: options = [options, .curveEaseIn, .curveEaseOut] - timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + timing = CAMediaTimingFunction(name: .easeInEaseOut) } autoreverses == true ? options.formUnion(.autoreverse) : options.subtract(.autoreverse) diff --git a/C4/UI/Timer.swift b/C4/UI/Timer.swift index d4147358..30d441af 100644 --- a/C4/UI/Timer.swift +++ b/C4/UI/Timer.swift @@ -64,7 +64,7 @@ public final class Timer: NSObject { } let t = Foundation.Timer(timeInterval: TimeInterval(interval), target: self, selector: #selector(Timer.fire), userInfo: nil, repeats: true) - RunLoop.main.add(t, forMode: RunLoopMode.defaultRunLoopMode) + RunLoop.main.add(t, forMode: .default) timer = t } diff --git a/C4/UI/UIGestureRecognizer+Closure.swift b/C4/UI/UIGestureRecognizer+Closure.swift index e62bea3f..8328135e 100644 --- a/C4/UI/UIGestureRecognizer+Closure.swift +++ b/C4/UI/UIGestureRecognizer+Closure.swift @@ -66,7 +66,7 @@ extension UIGestureRecognizer { } } -public typealias TapAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizerState) -> Void +public typealias TapAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizer.State) -> Void extension UITapGestureRecognizer { /// The closure to call when there is a gesture event. @@ -107,7 +107,7 @@ extension UITapGestureRecognizer { } } -public typealias PanAction = (_ locations: [Point], _ center: Point, _ translation: Vector, _ velocity: Vector, _ state: UIGestureRecognizerState) -> Void +public typealias PanAction = (_ locations: [Point], _ center: Point, _ translation: Vector, _ velocity: Vector, _ state: UIGestureRecognizer.State) -> Void extension UIPanGestureRecognizer { /// The closure to call when there is a gesture event. @@ -166,7 +166,7 @@ extension UIPanGestureRecognizer { } } -public typealias PinchAction = (_ locations: [Point], _ center: Point, _ scale: Double, _ velocity: Double, _ state: UIGestureRecognizerState) -> Void +public typealias PinchAction = (_ locations: [Point], _ center: Point, _ scale: Double, _ velocity: Double, _ state: UIGestureRecognizer.State) -> Void extension UIPinchGestureRecognizer { /// The closure to call when there is a gesture event. @@ -207,7 +207,7 @@ extension UIPinchGestureRecognizer { } } -public typealias RotationAction = (_ rotation: Double, _ velocity: Double, _ state: UIGestureRecognizerState) -> Void +public typealias RotationAction = (_ rotation: Double, _ velocity: Double, _ state: UIGestureRecognizer.State) -> Void extension UIRotationGestureRecognizer { /// The closure to call when there is a gesture event. @@ -244,7 +244,7 @@ extension UIRotationGestureRecognizer { } } -public typealias LongPressAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizerState) -> Void +public typealias LongPressAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizer.State) -> Void extension UILongPressGestureRecognizer { /// The closure to call when there is a gesture event. @@ -285,7 +285,7 @@ extension UILongPressGestureRecognizer { } } -public typealias SwipeAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizerState, _ direction: UISwipeGestureRecognizerDirection) -> Void +public typealias SwipeAction = (_ locations: [Point], _ center: Point, _ state: UIGestureRecognizer.State, _ direction: UISwipeGestureRecognizer.Direction) -> Void extension UISwipeGestureRecognizer { /// The closure to call when there is a gesture event. @@ -326,7 +326,7 @@ extension UISwipeGestureRecognizer { } } -public typealias ScreenEdgePanAction = (_ location: Point, _ state: UIGestureRecognizerState) -> Void +public typealias ScreenEdgePanAction = (_ location: Point, _ state: UIGestureRecognizer.State) -> Void extension UIScreenEdgePanGestureRecognizer { /// The closure to call when there is a gesture event. diff --git a/C4/UI/UIImage+Color.swift b/C4/UI/UIImage+Color.swift index b391f71d..9431e51f 100644 --- a/C4/UI/UIImage+Color.swift +++ b/C4/UI/UIImage+Color.swift @@ -25,7 +25,7 @@ public extension UIImage { /// - parameter color: The color to use when creating the image. /// - parameter size: The size of image to create. /// - returns: A UIImage filled with the specified color and whose dimensions equal the give size - public class func createWithColor(_ color: UIColor, size: CGSize) -> UIImage { + class func createWithColor(_ color: UIColor, size: CGSize) -> UIImage { let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height) UIGraphicsBeginImageContextWithOptions(size, false, 0) color.setFill() diff --git a/C4/UI/UIView+AddRemove.swift b/C4/UI/UIView+AddRemove.swift index 64d2e46c..731cde6a 100644 --- a/C4/UI/UIView+AddRemove.swift +++ b/C4/UI/UIView+AddRemove.swift @@ -72,9 +72,9 @@ extension UIView { /// - parameter subview: The subview to move to the back. public func sendToBack(_ subview: T?) { if let v = subview as? UIView { - self.sendSubview(toBack: v) + self.sendSubviewToBack(v) } else if let v = subview as? View { - self.sendSubview(toBack: v.view) + self.sendSubviewToBack(v.view) } else { fatalError("Can't operate on subview of class `\(type(of: subview))`") } @@ -85,9 +85,9 @@ extension UIView { /// - parameter subview: The subview to move to the front. public func bringToFront(_ subview: T?) { if let v = subview as? UIView { - self.bringSubview(toFront: v) + self.bringSubviewToFront(v) } else if let v = subview as? View { - self.bringSubview(toFront: v.view) + self.bringSubviewToFront(v.view) } else { fatalError("Can't operate on subview of class `\(type(of: subview))`") } diff --git a/C4/UI/UIViewController+C4View.swift b/C4/UI/UIViewController+C4View.swift index d271f5e0..cc4a9b32 100644 --- a/C4/UI/UIViewController+C4View.swift +++ b/C4/UI/UIViewController+C4View.swift @@ -38,7 +38,7 @@ private var canvasAssociationKey: UInt8 = 0 /// Where, `canvas` is essentially equal to `self.viewController.view`, keeping the interaction with a controller's main view consistent with using other View objects. public extension UIViewController { /// Returns a View object representation of the controller's `view` property. - public var canvas: View { + var canvas: View { if let canvas = objc_getAssociatedObject(self, &canvasAssociationKey) as? View { return canvas } diff --git a/C4/UI/View+Animation.swift b/C4/UI/View+Animation.swift index 7bd961d0..fffb3aed 100644 --- a/C4/UI/View+Animation.swift +++ b/C4/UI/View+Animation.swift @@ -40,7 +40,7 @@ public extension View { /// /// - parameter duration: The length of time in seconds for the animation to execute. /// - parameter animations: A block of code with specified animations to execute. - public class func animate(duration: Double, animations: @escaping () -> Void) { + class func animate(duration: Double, animations: @escaping () -> Void) { UIView.animate(withDuration: duration, animations: animations) } @@ -50,7 +50,7 @@ public extension View { /// - parameter delay: The length of time in seconds to wait before executing the specified block of code. /// - parameter completion: A block of code to execute when the animation completes. /// - parameter animations: A block of code with specified animations to execute. - public class func animate(duration: Double, delay: Double, animations: @escaping () -> Void, completion: ((Bool) -> Void)?) { + class func animate(duration: Double, delay: Double, animations: @escaping () -> Void, completion: ((Bool) -> Void)?) { UIView.animate(withDuration: duration, animations: animations, completion: completion) } @@ -61,7 +61,7 @@ public extension View { /// - parameter options: Options for animating views using block objects, see: UIViewAnimationOptions. /// - parameter animations: A block of code with specified animations to execute. /// - parameter completion: A block of code to execute when the animation completes. - public class func animate(duration: Double, delay: Double, options: UIViewAnimationOptions, animations: @escaping () -> Void, completion: ((Bool) -> Void)?) { + class func animate(duration: Double, delay: Double, options: UIView.AnimationOptions, animations: @escaping () -> Void, completion: ((Bool) -> Void)?) { UIView.animate(withDuration: duration, delay: delay, options: options, animations: animations, completion: completion) } } diff --git a/C4/UI/View+Border.swift b/C4/UI/View+Border.swift index cb006b82..1041ecc8 100644 --- a/C4/UI/View+Border.swift +++ b/C4/UI/View+Border.swift @@ -57,7 +57,7 @@ public extension View { /// ```` /// /// Assigning a new value to this will change the `borderWidth`, `borderColor` and `cornderRadius` of the receiver's layer. - public var border: Border { + var border: Border { get { var border = Border() if let layer = layer { diff --git a/C4/UI/View+Render.swift b/C4/UI/View+Render.swift index c5e0b93c..5d961ef7 100644 --- a/C4/UI/View+Render.swift +++ b/C4/UI/View+Render.swift @@ -22,7 +22,7 @@ import UIKit public extension View { /// Creates a flattened image of the receiver and its subviews / layers. /// - returns: A new Image - @objc public func render() -> Image? { + @objc func render() -> Image? { guard let l = layer else { print("Could not retrieve layer for current object: \(self)") return nil @@ -40,7 +40,7 @@ public extension Shape { /// Creates a flattened image of the receiver and its subviews / layers. /// This override takes into consideration the lineWidth of the receiver. /// - returns: A new Image - public override func render() -> Image? { + override func render() -> Image? { var s = CGSize(size) var inset: CGFloat = 0 diff --git a/C4/UI/View+Shadow.swift b/C4/UI/View+Shadow.swift index 9317b229..cc014deb 100644 --- a/C4/UI/View+Shadow.swift +++ b/C4/UI/View+Shadow.swift @@ -79,7 +79,7 @@ public extension View { /// v.shadow = s /// canvas.add(v) /// ```` - public var shadow: Shadow { + var shadow: Shadow { get { var shadow = Shadow() if let layer = layer { diff --git a/C4/UI/View.swift b/C4/UI/View.swift index 0faf73a1..271d0163 100644 --- a/C4/UI/View.swift +++ b/C4/UI/View.swift @@ -375,9 +375,9 @@ open class View: NSObject { /// - parameter subview: The subview to move to the back. public func sendToBack(_ subview: T?) { if let v = subview as? UIView { - view.sendSubview(toBack: v) + view.sendSubviewToBack(v) } else if let v = subview as? View { - view.sendSubview(toBack: v.view) + view.sendSubviewToBack(v.view) } else { fatalError("Can't operate on subview of class `\(type(of: subview))`") } @@ -387,9 +387,9 @@ open class View: NSObject { /// - parameter subview: The subview to move to the front. public func bringToFront(_ subview: T?) { if let v = subview as? UIView { - view.bringSubview(toFront: v) + view.bringSubviewToFront(v) } else if let v = subview as? View { - view.bringSubview(toFront: v.view) + view.bringSubviewToFront(v.view) } else { fatalError("Can't operate on subview of class `\(type(of: subview))`") } diff --git a/C4/UI/ViewAnimation.swift b/C4/UI/ViewAnimation.swift index 97e9586b..15ec384d 100644 --- a/C4/UI/ViewAnimation.swift +++ b/C4/UI/ViewAnimation.swift @@ -95,19 +95,19 @@ public class ViewAnimation: Animation { public var timingFunction: CAMediaTimingFunction { switch curve { case .linear: - return CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) + return CAMediaTimingFunction(name: .linear) case .easeOut: - return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) + return CAMediaTimingFunction(name: .easeOut) case .easeIn: - return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) + return CAMediaTimingFunction(name: .easeIn) case .easeInOut: - return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + return CAMediaTimingFunction(name: .easeInEaseOut) } } ///Options for animating views using block objects. - public var options: UIViewAnimationOptions { - var options: UIViewAnimationOptions = [UIViewAnimationOptions.beginFromCurrentState] + public var options: UIView.AnimationOptions { + var options: UIView.AnimationOptions = [UIView.AnimationOptions.beginFromCurrentState] switch curve { case .linear: options = [options, .curveLinear] diff --git a/Package.swift b/Package.swift new file mode 100644 index 00000000..7c4eaa88 --- /dev/null +++ b/Package.swift @@ -0,0 +1,23 @@ +// swift-tools-version:5.1 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "C4", + platforms: [.macOS(.v10_15), .iOS(.v9), .tvOS(.v9)], + products: [ + .library( + name: "C4", + targets: ["C4-iOS"]), + ], + targets: [ + .target( + name: "C4-iOS", + path: "C4"), + .testTarget( + name: "C4Tests-iOS", + dependencies: ["C4-iOS"], + path: "Tests"), + ] +)