TagStyledView
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Installation
TagStyledView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TagStyledView'
Usage
Setup in Interface Builder
-
In the Identity Inspector, set the layout object's custom class to
TagStyledView
.@IBOutlet weak var tagStyledView: TagStyledView!
-
Register a nib file for use in creating new collection view cells.
class TagCell1: UICollectionViewCell, TagStyling { @IBOutlet weak var tagLabel: UILabel! } class TagCell2: UICollectionViewCell, TagStyling { @IBOutlet weak var tagLabel: UILabel! } class TagCell3: UICollectionViewCell, TagStyling { @IBOutlet weak var tagLabel: UILabel! }
tagStyledView.register(UINib(nibName: TagCell1.Resource.identifier, bundle: nil), forCellWithReuseIdentifier: TagCell1.Resource.identifier) tagStyledView.register(UINib(nibName: TagCell2.Resource.identifier, bundle: nil), forCellWithReuseIdentifier: TagCell2.Resource.identifier) tagStyledView.register(UINib(nibName: TagCell3.Resource.identifier, bundle: nil), forCellWithReuseIdentifier: TagCell3.Resource.identifier)
💡 Pro Tip: You must implement theTagStyling
protocol.
Setup in code
-
Set tags data.
tagStyledView.tags = ["first", "second", "third", "fourth fourth fourth fourth fourth fourth fourth", "fifth"]
-
Customize
TagStyledView.Options
let options = TagStyledView.Options(sectionInset: .zero, lineSpacing: 10.0, interitemSpacing: 10.0, align: TagStyledView.Options.Alignment.left) tagStyledView.options = options
-
Run the app.
😎
Enjoy! Author
dave.pang, [email protected]
License
TagStyledView is available under the MIT license. See the LICENSE file for more info.