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

Replace AnyObject with Any #3864

Merged
merged 2 commits into from
Mar 6, 2019
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
2 changes: 1 addition & 1 deletion ChartsDemo-iOS/Objective-C/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class BalloonMarker: MarkerImage
fileprivate var label: String?
fileprivate var _labelSize: CGSize = CGSize()
fileprivate var _paragraphStyle: NSMutableParagraphStyle?
fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
fileprivate var _drawAttributes = [NSAttributedString.Key : Any]()

@objc public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
{
Expand Down
2 changes: 1 addition & 1 deletion ChartsDemo-iOS/Swift/Components/BalloonMarker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ open class BalloonMarker: MarkerImage
fileprivate var label: String?
fileprivate var _labelSize: CGSize = CGSize()
fileprivate var _paragraphStyle: NSMutableParagraphStyle?
fileprivate var _drawAttributes = [NSAttributedString.Key : AnyObject]()
fileprivate var _drawAttributes = [NSAttributedString.Key : Any]()

public init(color: UIColor, font: UIFont, textColor: UIColor, insets: UIEdgeInsets)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ open class BarDemoViewController: NSViewController
self.barChartView.chartDescription?.text = "Barchart Demo"
}

@IBAction func save(_ sender: AnyObject)
@IBAction func save(_ sender: Any)
{
let panel = NSSavePanel()
panel.allowedFileTypes = ["png"]
Expand Down
4 changes: 2 additions & 2 deletions Source/Charts/Utils/Platform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ public typealias NSUIGestureRecognizerState = UIGestureRecognizer.State
return _timestamp
}

init(target: AnyObject, selector: Selector)
init(target: Any, selector: Selector)
Copy link
Member

Choose a reason for hiding this comment

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

despite the weird indent here by github, why we use Any and again cast to AnyObject later
I assume using AnyObject is fine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to align with how ObjC APIs are imported into Swift. More info here: https://developer.apple.com/swift/blog/?id=39

We were only using AnyObject in the initializer because of weird objc interop.

Copy link
Member

Choose a reason for hiding this comment

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

oh no. I'm using Dash and cannot even found Any type. this kind of information is not easily to be aware of in my daily work..

{
_target = target
_target = target as AnyObject
_selector = selector

if CVDisplayLinkCreateWithActiveCGDisplays(&displayLink) == kCVReturnSuccess
Expand Down