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).
[nWords = 3] |
[nWords = 6] |
[nWords = 8] |
[nWords = 11] |
---|
[position = bottom] |
[position = center] |
[position = top] |
---|
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:
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.
You can do some customization with the support of CircularWordsCloud.
public enum CircularWordsCloudPosition {
case top, bottom, center
}
let circularWordsCloud = CircularWordsCloud(position: .top) // default = .center
circularWordsCloud.enableLongPressGesture = true
You can press and hold a word to use the feature to move to the new word cloud. Like below.
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.
@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.
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Xcode 10+
- Swift4+
CircularWordsCloud is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'CircularWordsCloud'
minsub0922, minsub0922@naver.com
CircularWordsCloud is available under the MIT license. See the LICENSE file for more info.