NMAC427 / SwiftOCR

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

Not compatible with Xcode 12 beta5 #179

Open leiguang opened 3 years ago

leiguang commented 3 years ago

error: the compiler is unable to type-check this expression. solution: explicitly declare the type of Modi { (modi: CGFloat) in ... }

WX20200824-161248@2x
diakobits commented 3 years ago

@leiguang Do you found the solution ? i have this problem too

alex955 commented 3 years ago

same

radeonxray commented 3 years ago

My work around: I moved randomFloat-constant outside of the generateRealisticCharSet-func (and removed the duplicate in generateCharSetFromImages), updated the randomFloat to self.randomFloat.

maticla commented 3 years ago

simply split the expression to multiple parts:

let randomFloat: (CGFloat) -> CGFloat = { modi in
        let temp = (0 - modi) + CGFloat(arc4random())
        let temp2 = CGFloat(UINT32_MAX) * (modi * 2)
        return temp / temp2
}