Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to swift 5.2 #669

Merged
merged 1 commit into from
Mar 26, 2020
Merged
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
1 change: 0 additions & 1 deletion Source/animation/AnimationProducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ class AnimationProducer {
}

let currentDate = Date()
var animationsToRemove = [Animation]()
let count = contentsAnimations.count
for (index, animationDesc) in contentsAnimations.reversed().enumerated() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ extension AnimationProducer {
func addCombineAnimation(_ combineAnimation: Animation, _ context: AnimationContext) {
guard let combine = combineAnimation as? CombineAnimation,
let renderer = combine.nodeRenderer,
let view = renderer.view else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed at all - just forgot to delete, sorry. The two below too

let _ = renderer.view else {
return
}

var animations = combine.animations
if let fromBounds = combine.node?.bounds, let toBounds = combine.toNodes.group().bounds {
if let _ = combine.node?.bounds, let _ = combine.toNodes.group().bounds {
let childAnimations = createChildAnimations(combine) as! [BasicAnimation]
animations.append(contentsOf: childAnimations)
}
Expand Down
5 changes: 4 additions & 1 deletion Source/model/draw/Color.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ open class Color: Fill {
return rgbt( r: r, g: g, b: b, t: 0 )
}

override func equals<T>(other: T) -> Bool where T: Color {
override func equals<T>(other: T) -> Bool where T: Fill {
guard let other = other as? Color else {
return false
}
return val == other.val
}
}
18 changes: 8 additions & 10 deletions Source/model/draw/Gradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ open class Gradient: Fill {
self.stops = stops
}

override func equals<T>(other: T) -> Bool where T: Gradient {
if userSpace == other.userSpace {

if stops.isEmpty && other.stops.isEmpty {
return true
}

return stops.elementsEqual(other.stops)

} else {
override func equals<T>(other: T) -> Bool where T: Fill {
guard let other = other as? Gradient, userSpace == other.userSpace else {
return false
}

if stops.isEmpty && other.stops.isEmpty {
return true
}

return stops.elementsEqual(other.stops)
}
}
5 changes: 4 additions & 1 deletion Source/model/draw/LinearGradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ open class LinearGradient: Gradient {
)
}

override func equals<T>(other: T) -> Bool where T: LinearGradient {
override func equals<T>(other: T) -> Bool where T: Fill {
guard let other = other as? LinearGradient else {
return false
}
return super.equals(other: other) && x1 == other.x1 && x2 == other.x2 && y1 == other.y1 && y2 == other.y2
}
}
12 changes: 10 additions & 2 deletions Source/model/draw/RadialGradient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ open class RadialGradient: Gradient {
)
}

override func equals<T>(other: T) -> Bool where T: RadialGradient {
return super.equals(other: other) && cx == other.cx && cy == other.cy && fx == other.fx && fy == other.fy && r == other.r
override func equals<T>(other: T) -> Bool where T: Fill {
guard let other = other as? RadialGradient else {
return false
}
let cxEquals = cx == other.cx
let cyEquals = cy == other.cy
let fxEquals = fx == other.fx
let fyEquals = fy == other.fy
let rEquals = r == other.r
return super.equals(other: other) && cxEquals && cyEquals && fxEquals && fyEquals && rEquals
}
}
6 changes: 3 additions & 3 deletions Source/svg/SVGParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ open class SVGParser {
if let units = element.allAttributes["patternContentUnits"]?.text, units == "objectBoundingBox" {
contentUserSpace = false
}

var contentNode: Node?
if pattern.children.isEmpty {
if let parentPattern = parentPattern {
Expand All @@ -483,7 +483,7 @@ open class SVGParser {
}
contentNode = Group(contents: shapes)
}

return UserSpacePattern(content: contentNode!,
bounds: bounds,
userSpace: userSpace,
Expand Down Expand Up @@ -1599,7 +1599,7 @@ open class SVGParser {
guard let element = stop.element else {
return .none
}

var offset: Double = 0 // This is default value, value can be omitted
if let parsedOffset = getDoubleValueFromPercentage(element, attribute: "offset") {
offset = parsedOffset
Expand Down
10 changes: 5 additions & 5 deletions Source/views/MacawView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ open class MacawView: MView, MGestureRecognizerDelegate {
#if os(OSX)
open override var layer: CALayer? {
didSet {
guard self.layer != nil else {
return
}
initializeView()
guard self.layer != nil else {
return
}
initializeView()

self.renderer = RenderUtils.createNodeRenderer(node, view: self)
self.renderer = RenderUtils.createNodeRenderer(node, view: self)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like in MacawView only formatting was changed and it's wrong :-) Could you please avoid these changes?

}
}
#endif
Expand Down