Skip to content

Instantly share code, notes, and snippets.

@tapi
Created February 26, 2014 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tapi/9236422 to your computer and use it in GitHub Desktop.
Save tapi/9236422 to your computer and use it in GitHub Desktop.
This is the funkiest assignment syntax I have ever seen used in Objective-C
_imageView = ({
UIImageView *imageView = [[UIImageView alloc] init];
imageView.contentMode = UIViewContentModeScaleAspectFill;
[self.scrollView addSubview:imageView];
imageView;
});
@reidmain
Copy link

Guaranteed that person wrote Ruby before Objective-C.

@dteare
Copy link

dteare commented Feb 26, 2014

[UIImageView new] would feel more natural with this style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment