I am trying to create a somewhat elegant navigation system for my App. Below is a function that attempts to return a View type. This does not compile with:
func getView(view: String) -> View {
switch view {
case "CreateUser":
return CreateNewsView()
default:
return nil
}
}
The above results in a compile error: Protocol 'View' can only be used as a generic constraint because it has Self or associated type requirements
Thank you for your help.