Skip to content

Commit

Permalink
Merge pull request #49 from frederik-jacques/master
Browse files Browse the repository at this point in the history
fixed Swift 4 warnings regarding use of `characters` property
  • Loading branch information
onmyway133 committed Nov 7, 2017
2 parents c47744e + 0cbad39 commit 05de7e3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Source/iOS/UIColor+Hue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down

0 comments on commit 05de7e3

Please sign in to comment.