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

Fixes for Swift 5.7 compiler #4823

Merged
merged 3 commits into from
Aug 28, 2022
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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ DerivedData
*.ipa
*.dSYM.zip
*.dSYM
*.dia
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These files get spewed out when compiling with the development toolchain so I added them to the ignore file.


## Playgrounds
timeline.xctimeline
Expand Down
8 changes: 4 additions & 4 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"repositoryURL": "https://github.com/apple/swift-algorithms",
"state": {
"branch": null,
"revision": "bb3bafeca0e164ece3403a9de646b7d38c07dd49",
"version": "0.0.2"
"revision": "b14b7f4c528c942f121c8b860b9410b2bf57825e",
"version": "1.0.0"
}
},
{
"package": "swift-numerics",
"repositoryURL": "https://github.com/apple/swift-numerics",
"state": {
"branch": null,
"revision": "6b24333510e9044cf4716a07bed65eeed6bc6393",
"version": "0.0.8"
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
"version": "1.0.2"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Xcode updated these automatically and I think its a reasonable update as they were very outdated.

}
}
]
Expand Down
6 changes: 3 additions & 3 deletions Source/Charts/Utils/ChartUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extension CGPoint
extension CGContext
{

open func drawImage(_ image: NSUIImage, atCenter center: CGPoint, size: CGSize)
public func drawImage(_ image: NSUIImage, atCenter center: CGPoint, size: CGSize)
{
var drawOffset = CGPoint()
drawOffset.x = center.x - (size.width / 2)
Expand Down Expand Up @@ -157,7 +157,7 @@ extension CGContext
NSUIGraphicsPopContext()
}

open func drawText(_ text: String, at point: CGPoint, align: TextAlignment, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat = 0.0, attributes: [NSAttributedString.Key : Any]?)
public func drawText(_ text: String, at point: CGPoint, align: TextAlignment, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat = 0.0, attributes: [NSAttributedString.Key : Any]?)
{
let drawPoint = getDrawPoint(text: text, point: point, align: align, attributes: attributes)

Expand All @@ -175,7 +175,7 @@ extension CGContext
}
}

open func drawText(_ text: String, at point: CGPoint, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat, attributes: [NSAttributedString.Key : Any]?)
public func drawText(_ text: String, at point: CGPoint, anchor: CGPoint = CGPoint(x: 0.5, y: 0.5), angleRadians: CGFloat, attributes: [NSAttributedString.Key : Any]?)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with the Xcode suggested fix here.

Copy link
Member

Choose a reason for hiding this comment

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

what's the error message for open?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't remember now, sorry.

Choose a reason for hiding this comment

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

what's the error message for open?

quoted from this issue:

Build error around CandleStickChartRenderer's and RadarChartRenderer's drawData(context: CGContext) where the IndexingIterator are not equivalent. Raw message:

error build: Referencing instance method 'makeIterator()' on 'Collection' requires the types 'IndexingIterator' and 'IndexingIterator' be equivalent

Copy link

Choose a reason for hiding this comment

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

The quoted issue doesn't seem to be relevant here. For me, the issue

CandleStickChartRenderer.swift:41:59: error build: Referencing instance method 'makeIterator()' on 'Collection' requires the types 'IndexingIterator<ChartData>' and 'IndexingIterator<CandleChartData>' be equivalent

still was still there with this PR's branch. It was gone only after I made the required conversions: radarData as ChartData in RadarChartRenderer:55 and candleData as ChartData at CandleStickChartRenderer:41

I am using Xcode 14 beta 3

Choose a reason for hiding this comment

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

+1

Choose a reason for hiding this comment

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

+1

Choose a reason for hiding this comment

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

The open vs public is not an error, but a build warning:

Non-'@objc' instance method in extensions cannot be overridden; use 'public' instead

Choose a reason for hiding this comment

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

The quoted issue doesn't seem to be relevant here. For me, the issue

CandleStickChartRenderer.swift:41:59: error build: Referencing instance method 'makeIterator()' on 'Collection' requires the types 'IndexingIterator<ChartData>' and 'IndexingIterator<CandleChartData>' be equivalent

still was still there with this PR's branch. It was gone only after I made the required conversions: radarData as ChartData in RadarChartRenderer:55 and candleData as ChartData at CandleStickChartRenderer:41

I am using Xcode 14 beta 3

This is the way!

{
var drawOffset = CGPoint()

Expand Down