zekunyan / TTGTagCollectionView

Useful for showing text or custom view tags in a vertical or horizontal scrollable view and support Autolayout at the same time. It is highly customizable that most features of the text tag can be configured. 标签流显示控件,同时支持文字或自定义View
http://tutuge.me
MIT License
1.89k stars 260 forks source link

Access text(String) property of the tag in Swift #107

Closed valenwalker closed 3 years ago

valenwalker commented 3 years ago

i can not access the text property using swift.

tag.content.text = Value of type 'TTGTextTagContent' has no member 'text'

zekunyan commented 3 years ago

TTGTextTagContent is just a abstract class. It has two subclass StringContent And AttributedStringContent. You should convert the tag.content to suitable class and access its value.

valenwalker commented 3 years ago

Thanks! its working now

onewhoz commented 2 years ago

Converting will look like let tagtext : TTGTextTagStringContent = tag.content as! TTGTextTagStringContent