From 5dcdde58ae1cb5b0658781970777a6ccaef03787 Mon Sep 17 00:00:00 2001 From: cywd Date: Tue, 19 Dec 2017 13:44:26 +0800 Subject: [PATCH] fix ``` 'characters' is deprecated: Please use String or Substring directly``` warnings --- Spring/Misc.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spring/Misc.swift b/Spring/Misc.swift index b2a27ce..902e7b3 100644 --- a/Spring/Misc.swift +++ b/Spring/Misc.swift @@ -23,7 +23,7 @@ import UIKit public extension String { - public var length: Int { return self.characters.count } + public var length: Int { return self.count } public func toURL() -> NSURL? { return NSURL(string: self) @@ -73,7 +73,7 @@ public extension UIColor { let scanner = Scanner(string: hex) var hexValue: CUnsignedLongLong = 0 if scanner.scanHexInt64(&hexValue) { - switch (hex.characters.count) { + switch (hex.count) { case 3: red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0