Hi! I have a custom struct that have 3 optional generic views (so I can use as Text, Navigation Item, Button or anything):
So, my the problem is when I am going to use it. Swift can't infer the type of the views, even when the are nil. How can I solve this problem?
I need this to use my init like this:
Currently I'm using like this:
or
Code Block struct CustomView<FirstT: View, SecondT: View, ThirdT: View>: View { var view1: FirstT? var view2: SecondT? var view3: ThirdT? var body: some View { ... } }
So, my the problem is when I am going to use it. Swift can't infer the type of the views, even when the are nil. How can I solve this problem?
I need this to use my init like this:
Code Block CustomView(view1: Text("Hi!"))
Currently I'm using like this:
Code Block CustomView(view1: Text("Hi!"), view2: Text(""), view3: : Text(""))
or
Code Block CustomView<Text, Text, Text>(view1: Text("Hi!"))