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

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font' #2816

Closed
snehageorge opened this issue Sep 22, 2017 · 12 comments
Closed

Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font' #2816

snehageorge opened this issue Sep 22, 2017 · 12 comments

Comments

@snehageorge
Copy link

snehageorge commented Sep 22, 2017

When updated Charts to 3.0.4 getting this error in Xcode 9.

Other errors are:

  1. Incorrect argument label in call (have 'withAttributes:', expected 'attributes:')
  2. Cannot convert value of type '[NSAttributedStringKey : Any]?' (aka 'Optional<Dictionary<NSString, Any>>') to expected argument type '[String : Any]?'
@karthikwifin
Copy link

karthikwifin commented Sep 22, 2017

I am also facing errors in most of the Charts classes after updating to 3.0.4

Incorrect argument label in call (have 'withAttributes:', expected 'attributes:')

@klemenzagar91
Copy link

I also noticed this. I fix it by setting swift version to 4.0 in the charts build settings in xcode
screen shot 2017-09-22 at 09 42 09

@snehageorge
Copy link
Author

I also fixed it. Thank You

@primax79
Copy link

how to fix in an ObjectiveC project?

@liuxuan30
Copy link
Member

it should have @objc tag to use, so update your code

@thaihauit
Copy link

attributes: [NSFontAttributeName: label.font]

@glaucomunsberg
Copy link

For Swift 3 use pod 'Charts','= 3.0.3'

@jonnyijapan
Copy link

I guess this should be fixed in this framework.

@jonnyijapan
Copy link

Btw, if using Pods:

  1. Select the Pods project in the left-most viewer in Xcode.
  2. Select Charts target.
  3. Build Settings
  4. Swift Language Version

@JoseVf
Copy link

JoseVf commented Jun 8, 2018

Ran into this problem with v. 3.1.1, I'm using Swift 4.1

@thaihauit
Copy link

thaihauit commented Jun 13, 2018 via email

@thaihauit
Copy link

let att: [NSAttributedStringKey: Any] = [
NSAttributedStringKey(rawValue: NSAttributedStringKey.font.rawValue) : UIFont.italicSystemFont(ofSize: 15.0),
NSAttributedStringKey(rawValue: NSAttributedStringKey.foregroundColor.rawValue) : Const.colorBlue500,
NSAttributedStringKey(rawValue: NSAttributedStringKey.underlineStyle.rawValue) : 1]
let attributeString = NSMutableAttributedString(string: "open_accessory_sheet".localize,
attributes: att)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants