exyte / Macaw

Powerful and easy-to-use vector graphics Swift library with SVG support
MIT License
6.01k stars 554 forks source link

Swift 5.2 support (Xcode 11.4) #668

Closed rjchatfield closed 4 years ago

rjchatfield commented 4 years ago

Macaw doesn't compile with Swift 5.2 included in Xcode 11.4 beta 1.

There are 4 compilation failures that I saw. This was in Gradient.swift:

image

Error message:

Overridden method 'equals' has generic signature <T where T : Gradient> which is incompatible with base method's generic signature <T where T : Fill>; expected generic signature to be <T where T : Fill>

Perhaps as a workaround to this to change the T: Gradient up to the expected T: Fill and the guard on the first line to cast it to the expected type, else false:

// Before:
override func equals<T>(other: T) -> Bool where T: Gradient {
    ...
}
// Suggestion:
override func equals<T>(other: T) -> Bool where T: Fill {
    guard let other = other as? Gradient else { 
        return false 
    }
    ...
}
amarunko commented 4 years ago

Hi, @rjchatfield, first of all, thank you for the suggestion, you are welcome to send a PR

amarunko commented 4 years ago

Yea, you are right this is an appropriate solution. I created a draft PR for new beta

khlopko commented 4 years ago

Hello! Any updates on that?

premedios commented 4 years ago

The proposed changes worked. Waiting on release of new version.

ystrot commented 4 years ago

Merged into master.