Learning swift..so I come across a scenario and not sure of right approach
I have a View controller in which subviews that load depending on the values in the object that is being passed
For eg: Consider a page where the object has name, phone (home, work, mobile), address, birthdate
Now in my view controller, I want to display fields like below picture
So my model looks like:
struct Info {
let name: String
let phone: [Phone]
let address: [Address]
let bday: String
}
For phones info, i need to loop thru phone array and add views appropriately. If that Phone struct has no mobile info then i dont need to display cell.
So I created XIB file and trying to load that custom view
Also I need to add constraints for "view with Home Phone" to "view with Mobile phone" etc.. so that they are aligned and show like picture above
So my question is
- How can i add that xib to my viewcontroller
2.Do I have add constraints it manually in code or is there any other way (Can you please gimme a example how i could add same)
If my approach is wrong, please let me know the right way of doing this
Your advice would be more valuable

UITableview?UITableView