Do we have an Interface which provided all the styles in ios?

Viewed 20

I have a Style struct

Struct Style {
    var borderColor : UIColor

   init(borderColor : UIColor){
       self.borderColor = UIColor
   }
}

Anyone can now apply styling using Style object. But now I want to give users flexibility of passing any number of styling not just borderColor.

For example :

Struct Style {
    var borderColor : UIColor
    var someStyle : someStyleType
   init(borderColor : UIColor, someStyle: someStyleType, ...){
       self.borderColor = borderColor
       self.someStyle = someStyle
   }
}

If I will keep on typing different type of style there no of properties of Style is going to be very large. So what I was thinking, is to keep it dynamic in some way. Can somebody help me with some approach?

I want something like this, can we do this?

we can pass any number of parameters using the constructor, like

Struct Style: SomeInterfaceWhichProvideAllTheStyle {
   init(borderColor : UIColor, someStyle: someStyleType, anyNoOfArguments){
       super.borderColor = borderColor
       super.textColor = textColorStyle
   }
}
0 Answers
Related