ios - Class extension vs. subclassing in Swift? -


i'am using third-party framework provides class instances have properties. in app, i'd add property instances. appropriate way scenario?

a) extending framework's class in app

b) creating subclass of framework's class , define new property need

thanks in advance

it's

b)

because adding (stored) properties in class extension not supported.

there 2 important rules using extensions:

  • extensions can add new functionality type, cannot override existing functionality

  • extensions can add new computed properties, cannot add stored properties, or add property observers existing properties


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -