ios - XCode Swift: Adding new class variables to existing Class -


i looking way extend existing class new variables without creating own new class, e.g. add nsindexpath uitableviewcell able access row or section without use of tags.

i known can add new functions extension

extension uitableviewcell {     // can     func myextendedfunction() {}     // not possible     var indexpath:nsindexpath } 

is there way this, or have build own classes?

you need subclass add properties class.

there workarounds relying on objc runtime allow associate objects each other, these should not used in typical case (they typically more complex subclassing, make relationships between objects non obvious, , have own limitations).


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -