 struct TimelineView: View {
 	
 	@EnvironmentObject private var timelineModel: TimelineModel
+	@State private var timelineItemFrames = [String: CGRect]()
 	
 	@ViewBuilder var body: some View {
-		GeometryReader { proxy in
+		GeometryReader { geometryReaderProxy in
 			#if os(macOS)
 			VStack {
 				HStack {

					.buttonStyle(PlainButtonStyle())
					.help(timelineModel.isReadFiltered ?? false ? "Show Read Articles" : "Filter Read Articles")
				}
				List(timelineModel.timelineItems, selection: $timelineModel.selectedArticleIDs) { timelineItem in
					let selected = timelineModel.selectedArticleIDs.contains(timelineItem.article.articleID)
					TimelineItemView(selected: selected, width: proxy.size.width, timelineItem: timelineItem)
				}
			}
			.navigationTitle(Text(verbatim: timelineModel.nameForDisplay))
			#else
			List(timelineModel.timelineItems) { timelineItem in
				ZStack {
					let selected = timelineModel.selectedArticleID == timelineItem.article.articleID
					TimelineItemView(selected: selected, width: proxy.size.width, timelineItem: timelineItem)
					NavigationLink(destination: ArticleContainerView(),
								   tag: timelineItem.article.articleID,
								   selection: $timelineModel.selectedArticleID) {
						EmptyView()
					}.buttonStyle(PlainButtonStyle())
				}
			}
			.navigationBarTitle(Text(verbatim: timelineModel.nameForDisplay), displayMode: .inline)

    }

}

struct TimelineItemFramePreferenceKey: PreferenceKey {
	typealias Value = [TimelineItemFramePreference]

	static var defaultValue: [TimelineItemFramePreference] = []
	
	static func reduce(value: inout [TimelineItemFramePreference], nextValue: () -> [TimelineItemFramePreference]) {
		value.append(contentsOf: nextValue())
	}
}

struct TimelineItemFramePreference: Equatable {
	let articleID: String
	let frame: CGRect
}

struct TimelineItemFramePreferenceView: View {
	let timelineItem: TimelineItem
	
	var body: some View {
		GeometryReader { proxy in
			Rectangle()
				.fill(Color.clear)
				.preference(key: TimelineItemFramePreferenceKey.self,
							value: [TimelineItemFramePreference(articleID: timelineItem.article.articleID, frame: proxy.frame(in: .global))])
		}
	}
}
