IceCubes/IceCubesApp/App/AppRouteur.swift
Thomas Ricouard 3d7042832e Open HashTag
2022-12-20 15:37:51 +01:00

33 lines
867 B
Swift

import SwiftUI
import Timeline
import Account
import Routeur
import Status
import DesignSystem
extension View {
func withAppRouteur() -> some View {
self.navigationDestination(for: RouteurDestinations.self) { destination in
switch destination {
case let .accountDetail(id):
AccountDetailView(accountId: id)
case let .accountDetailWithAccount(account):
AccountDetailView(account: account)
case let .statusDetail(id):
StatusDetailView(statusId: id)
case let .hashTag(tag):
TimelineView(timeline: .hashtag(tag: tag))
}
}
}
func withSheetDestinations(sheetDestinations: Binding<SheetDestinations?>) -> some View {
self.sheet(item: sheetDestinations) { destination in
switch destination {
case let .imageDetail(url):
ImageSheetView(url: url)
}
}
}
}