mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 13:15:35 +03:00
wrapping deprecation warnings to resolve warnings
This commit is contained in:
parent
471d30516c
commit
45daee32a4
@ -23,7 +23,11 @@ class MDisplayLink: MDisplayLinkProtocol {
|
|||||||
self.onUpdate = onUpdate
|
self.onUpdate = onUpdate
|
||||||
|
|
||||||
displayLink = CADisplayLink(target: self, selector: #selector(updateHandler))
|
displayLink = CADisplayLink(target: self, selector: #selector(updateHandler))
|
||||||
|
if #available(iOS 10.0, *) {
|
||||||
|
displayLink?.preferredFramesPerSecond = 1
|
||||||
|
} else {
|
||||||
displayLink?.frameInterval = 1
|
displayLink?.frameInterval = 1
|
||||||
|
}
|
||||||
displayLink?.add(to: RunLoop.current, forMode: RunLoop.Mode.default)
|
displayLink?.add(to: RunLoop.current, forMode: RunLoop.Mode.default)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,14 +544,14 @@ open class SVGParser {
|
|||||||
|
|
||||||
stopParse: while !scanner.isAtEnd {
|
stopParse: while !scanner.isAtEnd {
|
||||||
guard let attributeName = scanner.scannedCharacters(from: .transformationAttributeCharacters),
|
guard let attributeName = scanner.scannedCharacters(from: .transformationAttributeCharacters),
|
||||||
scanner.scanString("(", into: nil),
|
scanner.scannedString("(") != nil,
|
||||||
let valuesString = scanner.scannedUpToString(")"),
|
let valuesString = scanner.scannedUpToString(")"),
|
||||||
scanner.scanString(")", into: nil) else {
|
scanner.scannedString(")") != nil else {
|
||||||
break stopParse
|
break stopParse
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip an optional comma after ")".
|
// Skip an optional comma after ")".
|
||||||
_ = scanner.scanString(",", into: nil)
|
_ = scanner.scannedString(",")
|
||||||
|
|
||||||
let values = parseTransformValues(valuesString)
|
let values = parseTransformValues(valuesString)
|
||||||
if values.isEmpty {
|
if values.isEmpty {
|
||||||
@ -654,7 +654,7 @@ open class SVGParser {
|
|||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
_ = scanner.scanString(",", into: nil)
|
_ = scanner.scannedString(",")
|
||||||
}
|
}
|
||||||
|
|
||||||
return collectedValues
|
return collectedValues
|
||||||
@ -704,7 +704,13 @@ open class SVGParser {
|
|||||||
cleanedHexString = "\(x[0])\(x[0])\(x[1])\(x[1])\(x[2])\(x[2])"
|
cleanedHexString = "\(x[0])\(x[0])\(x[1])\(x[1])\(x[2])\(x[2])"
|
||||||
}
|
}
|
||||||
var rgbValue: UInt32 = 0
|
var rgbValue: UInt32 = 0
|
||||||
|
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
|
||||||
|
if let scannedInt = Scanner(string: cleanedHexString).scanUInt64(representation: .hexadecimal) {
|
||||||
|
rgbValue = UInt32(scannedInt)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Scanner(string: cleanedHexString).scanHexInt32(&rgbValue)
|
Scanner(string: cleanedHexString).scanHexInt32(&rgbValue)
|
||||||
|
}
|
||||||
|
|
||||||
let red = CGFloat((rgbValue >> 16) & 0xff)
|
let red = CGFloat((rgbValue >> 16) & 0xff)
|
||||||
let green = CGFloat((rgbValue >> 08) & 0xff)
|
let green = CGFloat((rgbValue >> 08) & 0xff)
|
||||||
@ -994,11 +1000,10 @@ open class SVGParser {
|
|||||||
|
|
||||||
let scanner = Scanner(string: pointsString)
|
let scanner = Scanner(string: pointsString)
|
||||||
while !scanner.isAtEnd {
|
while !scanner.isAtEnd {
|
||||||
var resultPoint: Double = 0
|
if let resultPoint = scanner.scannedDouble() {
|
||||||
if scanner.scanDouble(&resultPoint) {
|
|
||||||
resultPoints.append(resultPoint)
|
resultPoints.append(resultPoint)
|
||||||
}
|
}
|
||||||
_ = scanner.scanCharacters(from: [","], into: nil)
|
_ = scanner.scannedString(",")
|
||||||
}
|
}
|
||||||
|
|
||||||
if resultPoints.count % 2 == 1 {
|
if resultPoints.count % 2 == 1 {
|
||||||
@ -2196,6 +2201,16 @@ fileprivate extension Scanner {
|
|||||||
return scanUpTo(substring, into: &string) ? string as String? : nil
|
return scanUpTo(substring, into: &string) ? string as String? : nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A version of `scanString(_:)`, available for an earlier OS.
|
||||||
|
func scannedString(_ searchString: String) -> String? {
|
||||||
|
if #available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
|
||||||
|
return scanString(searchString)
|
||||||
|
} else {
|
||||||
|
var string: NSString?
|
||||||
|
return scanString(searchString, into: &string) ? string as String? : nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fileprivate extension CharacterSet {
|
fileprivate extension CharacterSet {
|
||||||
|
Loading…
Reference in New Issue
Block a user