Avatar
よしこんな感じに落ち着かせ(ることにし)た protocol RouterObject: ObservableObject { associatedtype Login: View = EmptyView func loginView() -> Login associatedtype Home: View = EmptyView func homeView() -> Home } extension RouterObject { func loginView() -> EmptyView { EmptyView() } func homeView() -> EmptyView { EmptyView() } } final class Router: RouterObject { func loginView() -> Text { Text("Login") } } Router().loginView() Router().homeView()