NetNewsWire/Multiplatform/Shared/Timeline/TimelineContainerView.swift

64 lines
1.3 KiB
Swift
Raw Normal View History

2020-06-30 18:03:33 +02:00
//
// TimelineContainerView.swift
// NetNewsWire
//
// Created by Maurice Parker on 6/30/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
2020-07-01 18:13:11 +02:00
import Account
2020-06-30 18:03:33 +02:00
struct TimelineContainerView: View {
@EnvironmentObject private var sceneModel: SceneModel
@StateObject private var timelineModel = TimelineModel()
2020-07-01 18:13:11 +02:00
var feed: Feed? = nil
2020-06-30 18:03:33 +02:00
@ViewBuilder var body: some View {
2020-07-01 18:13:11 +02:00
if let feed = feed {
TimelineView()
.environmentObject(timelineModel)
.onAppear {
sceneModel.timelineModel = timelineModel
timelineModel.delegate = sceneModel
timelineModel.rebuildTimelineItems(feed)
}
.toolbar {
2020-07-04 04:55:27 +02:00
#if os(iOS)
ToolbarItem {
Button(action: {
}, label: {
AppAssets.markAllAsReadImage
.foregroundColor(.accentColor)
}).help("Mark All As Read")
}
ToolbarItem {
Spacer()
}
ToolbarItem {
Text("Last updated")
.font(.caption)
.foregroundColor(.secondary)
}
ToolbarItem {
Spacer()
}
ToolbarItem {
Button(action: {
}, label: {
AppAssets.nextUnreadArticleImage
.resizable()
.scaledToFit()
.frame(width: 22, height: 22, alignment: .center)
})
}
2020-07-04 04:55:27 +02:00
#endif
}
2020-07-01 18:13:11 +02:00
} else {
EmptyView()
}
2020-06-30 18:03:33 +02:00
}
}