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

Compiler Warning on Advanced Views usage #106

Closed
aaronschubert0 opened this issue Apr 13, 2015 · 4 comments
Closed

Compiler Warning on Advanced Views usage #106

aaronschubert0 opened this issue Apr 13, 2015 · 4 comments
Labels

Comments

@aaronschubert0
Copy link
Contributor

I was following the guide as specified here:
http://componentkit.org/docs/advanced-views.html
And implemented the following code

@implementation AndFinallyNewsStoryComponent
+ (instancetype)newWithHeadline:(NSString *)headline
               shortDescription:(NSString *)shortDescription
                          stats:(NSAttributedString *)stats
                       andImage:(UIImage *)image
{
    return [super newWithComponent:
            [CKComponent
             newWithView:{&gradientOverlay}
             size:{.width = 50,.height = 50}]];
}

static GradientOverlay *gradientOverlay(void) {
    return [[GradientOverlay alloc] initWithColor:[UIColor redColor]];
}

This produces an unexpected compiler warning in the form of: Incompatible pointer types passing 'GradientOverlay ()()' to parameter of type 'UIView ()()'

GradientOverlay is currently a subclass of UIView, should this be something else? It's not specified in the docs of any additional changes needed.

@adamjernst
Copy link
Contributor

Nope this is simply an error. Mind submitting a pull request to fix it?

@aaronschubert0
Copy link
Contributor Author

Can do. Do you mean this is an error in the docs or code? Just wanting to clarify.

Edit: I presume it's the docs just to change it to this:

static UIView *authorViewForOscarWilde(void) {
    return [[AuthorView alloc] initWithName:@"Oscar Fingal O'Flahertie Wills Wilde"];
}
// ...
[CKComponent newWithView:{&authorViewForOscarWilde} size:{50, 50}]

aaronschubert0 added a commit to aaronschubert0/componentkit that referenced this issue Apr 13, 2015
Updated the example so that a UIView is returned, rather than the custom class, this ensures issue facebook#106 is avoided.
@adamjernst
Copy link
Contributor

Error in the docs.

On Apr 13, 2015, at 11:06 AM, aaronschubert0 notifications@github.com wrote:

Can do. Do you mean this is an error in the docs or code? Just wanting to clarify.


Reply to this email directly or view it on GitHub.

@aaronschubert0
Copy link
Contributor Author

Cool, submitted the PR and have signed the CLA.

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

No branches or pull requests

3 participants