SwiftRulerView icon indicating copy to clipboard operation
SwiftRulerView copied to clipboard

scan.scanFloat(&value) && scan.isAtEnd have warning

Open oddukgi opened this issue 5 years ago • 0 comments

This code have annoying

    func judgeTextsHasWord(texts:String) -> Bool{
        let scan:Scanner = Scanner.init(string: texts)
        var value:Float = 0.0
        return scan.scanFloat(&value) && scan.isAtEnd   // 'scanFloat' was deprecated in iOS 13.0
    }

I changed code.

I tested 4.2, 4.4.

    func judgeTextsHasWord(texts:String) -> Bool{
        let scan:Scanner = Scanner.init(string: texts)
       return (scan.scanFloat(representation: .decimal) != nil)  && scan.isAtEnd
    }

oddukgi avatar Jul 31 '20 10:07 oddukgi