import SwiftUI /// git's range-diff between two revisions of a merge request, as the /// command prints it — the same monospaced text treatment as a build log. struct RangeDiffView: View { @State private var model: RangeDiffViewModel init(client: GitbayClient, repo: String, number: Int64, from: String, to: String) { _model = State(initialValue: RangeDiffViewModel( client: client, repoPath: repo, number: number, from: from, to: to)) } var body: some View { ZStack { Color.clear if let text = model.state.value { ScrollView([.horizontal, .vertical]) { Text(text) .font(.gbMono(.caption2)) .frame(maxWidth: .infinity, alignment: .leading) .padding(12) .textSelection(.enabled) } } } .overlay { LoadStateOverlay(state: model.state) } .navigationTitle("\(model.from.prefix(7))…\(model.to.prefix(7))") .navigationBarTitleDisplayMode(.inline) .task { await model.load() } } }