Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Added support for UIColor #25

Merged
merged 34 commits into from Aug 27, 2015
Merged

Added support for UIColor #25

merged 34 commits into from Aug 27, 2015

Conversation

sgl0v
Copy link
Contributor

@sgl0v sgl0v commented May 1, 2014

Implemented feature to edit color value with RGB/HSB color pickers.

sgl0v added 23 commits April 7, 2014 23:26
…ility of applying custom gradient colors to it.
…ew class, changed color selection controller accordingly, added missed comments.
…oject warnings, changed demo project to edit background color.
@sgl0v sgl0v changed the title Color editor Added support for UIColor May 5, 2014
@alistra
Copy link

alistra commented Jul 9, 2014

Is this planned to be merged in?

@grp
Copy link
Contributor

grp commented Jul 9, 2014

Sorry about leaving this hanging! I wanted to make a few small changes and get it to merge, but it dropped off my radar. I'll get it merged in soon.

@bradleydwyer
Copy link

Would love to see support for UIColor!

@kitschpatrol
Copy link

This addition is super helpful! A merge would be great.

@landfound
Copy link

anyone cares this issue?

@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

…he keyboard manager's field for controllers, that have content to adjust. Updated the _FBKeyboardManager class accordingly.
…onsistent. Defined the data sources for rgb and hsb views, color wheel and color component cells. Changed the color controller accordingly.
@sgl0v
Copy link
Contributor Author

sgl0v commented Aug 17, 2015

Hello, guys. Finally I've updated the pull request(merged master branch & fixed all issues I had) and made some changes in the UI (now it is UITableView-based and looks consistent with all other components.). Enjoy!

@grp
Copy link
Contributor

grp commented Aug 17, 2015

I took a quick look at it looks great! A few overall points before I add some notes inline:

  • Interesting for the choice of representing a color as a hex-string — any reason not to use UIColor directly? Since the 2.0.0 update (adding array support), you should be able to put any NSObject into the tweak value field since they're created lazily through a block at runtime. This would also help avoiding type issues if you legitimately do want a Tweak with a string starting with "#".
  • A few of the views use auto-layout, but we generally don't use that at Facebook and it occasionally causes compatibility issues. Could you make those use -layoutSubviews instead? (If that would be complicated, it's probably fine as-is, but a little harder to understand.)
  • Mostly a nit: the rest of the code has the * in pointers next to the variable name, rather than next to the type as you have it for your changes.

@grp
Copy link
Contributor

grp commented Aug 17, 2015

Finally, the HSV support is pretty cool, but it looks like it adds a few more classes just for that. Maybe for simplicity it could just be RGB to start?

* @param rgb The rgb color values
* @param outHSB The hsb color values
*/
extern void FBRGB2HSB(RGB rgb, HSB* outHSB);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to use pointers here versus just a return value?

@grp
Copy link
Contributor

grp commented Aug 17, 2015

Finally, any chance you could post a few screenshots? I'll download it and try it out but best to see it in context.

@sgl0v
Copy link
Contributor Author

sgl0v commented Aug 27, 2015

Hello Grant,

Looks like I managed to fix all issues you mentioned.

  • Replaced the hex-string color representation with UIColor;
  • Removed the auto-layout constraints, added the layoutSubviews method implementations instead;
  • Minor changes according to the code review.

Yes, probably it would be better to start from the RGB support.

Now it works in this way:
Alt Text

@grp grp merged commit eab620c into facebookarchive:master Aug 27, 2015
@grp
Copy link
Contributor

grp commented Aug 27, 2015

It's merged! I did a little bit of cleanup on the documentation side, but otherwise looks awesome. Thanks again for making this!

@alistra
Copy link

alistra commented Aug 28, 2015

I waited for this for so long, is there any cocoapods release planned soon with this?

@@ -58,6 +59,9 @@ - (void)testValueTypes
__attribute__((unused)) NSString *testNSString = FBTweakValue(@"NSString", @"NSString", @"NSString", @"one");
XCTAssertEqualObjects(testNSString, @"one", @"NSString %@", testNSString);

__attribute__((unused)) UIColor *testUIColor = FBTweakValue(@"UIColor", @"UIColor", @"UIColor", [UIColor redColor], [UIColor redColor]);
XCTAssertEqualObjects([UIColor redColor], [UIColor redColor], @"UIColor %@", testUIColor);

Choose a reason for hiding this comment

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

this doesn't test anything

Choose a reason for hiding this comment

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

it should be
XCTAssertEqualObjects(testUIColor, [UIColor redColor], @"UIColor %@", testUIColor);

Choose a reason for hiding this comment

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet