maciekish / WeightedWordCloud

A simple word cloud renderer in Objective-C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WeightedWordCloud

Version License Platform

Works with any Objective-C project, including app extensions like today widgets and Apple Watch (WatchKit) apps.

alt text

Example usage with WatchKit

Import the header

#import <WeightedWordCloud/HITWeightedWordCloud.h>

Create and configure a HITWeightedWordCloud object. You can do this in (void)awakeWithContext:(id)context

self.wordCloud = [HITWeightedWordCloud.alloc initWithSize:CGSizeMake(CGRectGetWidth(self.contentFrame), CGRectGetHeight(self.contentFrame)];
self.wordCloud.textColor = UIColor.whiteColor;
self.wordCloud.scale = WKInterfaceDevice.currentDevice.screenScale;

Set data and render a word cloud. The dictionary key is your word and the value is the weight. The weight controls the font size of the words in the rendered cloud.

NSDictionary *wordsDictionary = @{@"Very important": @500,
								  @"Still important": @400,
                                  @"Less important": @100,
                                  @"Not important at all": @0};
[self.imageView setImage:[self.wordCloud imageWithWords:wordsDictionary]];

See the header file for more options.

Requirements

  • Xcode 6.3.1
  • ARC

Installation

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

pod 'WeightedWordCloud', '0.1.0'

Author

Maciej Swic, maciej@swic.name

License

WeightedWordCloud is available under the MIT license. See the LICENSE file for more info.

About

A simple word cloud renderer in Objective-C

License:MIT License


Languages

Language:Objective-C 92.7%Language:Ruby 7.3%