1
1
mirror of https://github.com/exyte/Macaw.git synced 2024-09-17 16:07:44 +03:00

Swift 5.2 support

This commit is contained in:
Yuri Strot 2020-04-10 20:05:12 +07:00
parent 67a1fa7a14
commit b5d0d5fd78
6 changed files with 30 additions and 16 deletions

View File

@ -313,7 +313,6 @@ class AnimationProducer {
}
let currentDate = Date()
var animationsToRemove = [Animation]()
let count = contentsAnimations.count
for (index, animationDesc) in contentsAnimations.reversed().enumerated() {

View File

@ -60,7 +60,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
}
}

View File

@ -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)
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -386,7 +386,10 @@ open class SVGParser {
contentNode = Group(contents: shapes)
}
return UserSpacePattern(content: contentNode!, bounds: bounds, userSpace: userSpace, contentUserSpace: contentUserSpace)
return UserSpacePattern(content: contentNode!,
bounds: bounds,
userSpace: userSpace,
contentUserSpace: contentUserSpace)
}
fileprivate func parseGroup(_ group: XMLIndexer, style: [String: String]) throws -> Group? {