shergin / NSView-MISSINGVisibility

A very tiny library that add `visibility` concept (somethings like property `hidden` but better) for NSView

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NSView+MISSINGVisibility

Version License Platform

A very tiny library that add visibility concept (somethings like property hidden but better) for NSView. It allows easily to show and hide views with animation and passion.

Besides, it allows to avoid using "negative boolean logic" (see Code Complete, page 269, Use positive boolean variable names for more information).

Usage

#import "NSView+MISSINGVisibility.h"


NSButton *button = [[NSButton alloc] initWithFrame:buttonFrame];
NSProgressIndicator *indicator = [[NSProgressIndicator alloc] initWithFrame:indicatorFrame];
indicator.hidden = YES;

// And later instead of use `button.hidden = YES;` you can use:

[button setVisible:NO animated:YES];

// And animation will start but property `isVisible` become `NO` synchronously.
// And you will be able access it and control it consistently. Like this:

[indicator setVisible:(!button.isVisible) animated:YES];

Requirements

Nothing.

Installation

NSView+MISSINGVisibility is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "NSView+MISSINGVisibility"

Author

Valentin Shergin, valentin@shergin.com

License

NSView+MISSINGVisibility is available under the MIT license. See the LICENSE file for more info.

About

A very tiny library that add `visibility` concept (somethings like property `hidden` but better) for NSView

License:MIT License


Languages

Language:Objective-C 82.8%Language:Ruby 17.2%