NMAC427 / SwiftOCR

Fast and simple OCR library written in Swift
Apache License 2.0
4.61k stars 481 forks source link

Multiple Errors. #110

Closed LonoS closed 6 years ago

LonoS commented 6 years ago

So i tried to fix those two errors for a long time now. I found nothing useful on the internet. First one: Type 'NSString' has no member 'font'

return [.font: randomFont(),
                    .kern: CGFloat(8) as NSObject,
                    .foregroundColor: OCRColor(red: 27/255 + randomFloat(0.2), green: 16/255 + randomFloat(0.2), blue: 16/255 + randomFloat(0.2), alpha: 80/100 + randomFloat(0.2)),
                    .paragraphStyle: paragraphStyle]

Second one:

Cannot invoke 'draw' with an argument list of type '(in: CGRect, withAttributes: [NSAttributedStringKey : Any])'

NSString(string: code).draw(in: CGRect(origin: CGPoint(x: 0 + randomFloat(5), y: -15.5 + randomFloat(5)), size: randomImg.size), withAttributes: randomFontAttributes())

Thanks in advance for your answers.

frakman1 commented 6 years ago

@garnele007 Why did you close this without any comment?

palmerc commented 5 years ago

Set the SWIFT_VERSION to 4.

mark-bragg commented 5 years ago

@palmerc, setting swift version to 4, didn't fix this for me