Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows getting the hue, saturation and brightness components of UIColor. #51

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Source/iOS/UIColor+Hue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,30 @@ public extension UIColor {
return a
}
}

var hueComponent : CGFloat {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the space before the : to match our convention?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's funny because I never leave that space but left it following the coding convention on the same extension you used for redComponent.

get {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is computed property, I don't think you need get here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as before, I know you don't need the get, but left it following the coding convention on the same extension you used for redComponent.

var hue : CGFloat = 0
getHue(&hue, saturation: nil, brightness: nil, alpha: nil)
return hue
}
}

var saturationComponent : CGFloat {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use 2 spaces indentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think my Xcode defaults to 4 spaces indentation. I'll check.

get {
var saturation : CGFloat = 0
getHue(nil, saturation: &saturation, brightness: nil, alpha: nil)
return saturation
}
}

var brightnessComponent : CGFloat {
get {
var brightness : CGFloat = 0
getHue(nil, saturation: nil, brightness: &brightness, alpha: nil)
return brightness
}
}
}


Expand Down