gitbay/Views/Repos/BookmarkListView.swift

v1.6.0
gitbay-ios/gitbay/Views/Repos/BookmarkListView.swift history · blame · raw

26 lines · 755 bytes

 1import SwiftUI
 2
 3/// The bookmarks list, reached from the Repositories tab.
 4struct BookmarkListView: View {
 5
 6    @State private var model: BookmarkListViewModel
 7
 8    init(client: GitbayClient) {
 9        _model = State(initialValue: BookmarkListViewModel(client: client))
10    }
11
12    var body: some View {
13        List {
14            ForEach(model.state.value ?? []) { repo in
15                NavigationLink(value: RepoRoute.repo(repo.path)) {
16                    RepoRow(repo: repo)
17                }
18            }
19        }
20        .overlay { LoadStateOverlay(state: model.state) }
21        .navigationTitle("Bookmarks")
22        .navigationBarTitleDisplayMode(.inline)
23        .task { await model.load() }
24        .refreshable { await model.load() }
25    }
26}