/CircularWordsCloud

Circular Word Cloud with N-Words Selector

Primary LanguageSwiftMIT LicenseMIT

CircularWordsCloud

Platform iOS Carthage compatible License: MIT

Circular Words Cloud with N-Words Selector ( + M-Depth Searching)

Made with Team SISISI by k-elon.

Circular Words Cloud for iOS !

CircularWordsCloud is a Container View that allows us to implement word map easily. You can use it for presenting Word Relationships or TItle-Subtitles Architecture (like Tree).

1 1 1

CircularWordsCloud Types

n-words selecting type

1

[nWords = 3]
1

[nWords = 6]
1

[nWords = 8]
1

[nWords = 11]

m-depth searching type

1

position types

1

[position = bottom]
1

[position = center]
1

[position = top]

Usage

Basically, we just need to add CircularWordsCloud as subview of your view which will be superview of it. And you should set delegate of it.

The size of the view and the autolayouts are set automatically. Ofcourse you can custom if you want!

Let's see the steps to do this:

Set CircularWordsCloud

override func viewDidLoad() {
    super.viewDidLoad()

  let circularWordsCloud = CircularWordsCloud()
  circularWordsCloud.delegate = self
  view.addSubview(circularWordsCloud)
}

Isn't it really simple ?! Now you can use CircularWordsCloud if you meet a few things.

extension ViewController: CircularWorsCloudDelegate {
    var wordForAxis: String {
        return "CenterWord"
    }
    
    var wordsForCloud: [String] {
        return ["Words","That","You","Want","Show","Around", "The", "Central Word"]
    }
}

What you need to do. s really over.

Options

You can do some customization with the support of CircularWordsCloud.

Select Position

public enum CircularWordsCloudPosition {
    case top, bottom, center
}

let circularWordsCloud = CircularWordsCloud(position: .top)    // default = .center

M-Depth Seaching Process

circularWordsCloud.enableLongPressGesture = true

You can press and hold a word to use the feature to move to the new word cloud. Like below.

1

Give Weight on Words

extension ViewController: CircularWorsCloudDelegate {
    var ranksForWords: [Int] {
        return [1,7,5,2,6,2,7,3]
    }
}    

You can give weight on your words. Then the size changes to match the weight assigned to each word.

1

Event Listeners

@objc public protocol CircularWorsCloudDelegate: NSObjectProtocol {
    // MARK:- Functions
    @objc optional func circularWordsCloud(_ circularWordsCloud: CircularWordsCloud,
                                           didSelectWord: String)
    
    @objc optional func circularWordsCloud(_ circularWordsCloud: CircularWordsCloud,
                                           didDeselectWord: String)
    
    @objc optional func circularWordsCloudDidExpand()
    
    @objc optional func circularWordsCloudDidCollapse()
    
    @objc optional func circularWordsCloud(_ circularWordsCloud: CircularWordsCloud,
                                           newAxisWord: String,
                                           depth: Int,
                                           completion: @escaping ( _ newCloudWords: [String])-> Void)
}

You can handle various events in CircularWordsCloud.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • Xcode 10+
  • Swift4+

Installation

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

pod 'CircularWordsCloud'

Author

minsub0922, minsub0922@naver.com

License

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