From 0cbad392c85cf64a24db4f7ff545fd58b1b4bb5e Mon Sep 17 00:00:00 2001 From: Frederik Jacques Date: Tue, 7 Nov 2017 09:09:07 +0100 Subject: [PATCH] fixed Swift 4 warnings regarding use of `characters` property --- Source/iOS/UIColor+Hue.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/iOS/UIColor+Hue.swift b/Source/iOS/UIColor+Hue.swift index e8cd43b..f0d84a3 100644 --- a/Source/iOS/UIColor+Hue.swift +++ b/Source/iOS/UIColor+Hue.swift @@ -8,15 +8,15 @@ public extension UIColor { /// - Parameter hex: A hex string, can either contain # or not convenience init(hex string: String) { var hex = string.hasPrefix("#") - ? String(string.characters.dropFirst()) + ? String(string.dropFirst()) : string - guard hex.characters.count == 3 || hex.characters.count == 6 + guard hex.count == 3 || hex.count == 6 else { self.init(white: 1.0, alpha: 0.0) return } - if hex.characters.count == 3 { - for (index, char) in hex.characters.enumerated() { + if hex.count == 3 { + for (index, char) in hex.enumerated() { hex.insert(char, at: hex.index(hex.startIndex, offsetBy: index * 2)) } }