Skip to content

Commit

Permalink
Remove unnecessary ItemListView wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsimeon authored and Jacob Morris committed Jul 27, 2021
1 parent 61e0621 commit 0955be4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
21 changes: 0 additions & 21 deletions PocketKit/Sources/PocketKit/Item/ItemListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,6 @@ import CoreData


struct ItemListView: View {
private let context: NSManagedObjectContext
private let selection: ItemSelection

init(
context: NSManagedObjectContext,
selection: ItemSelection
) {
self.context = context
self.selection = selection
}

var body: some View {
_ItemListView(selection: selection)
.environment(\.managedObjectContext, context)
}
}

private struct _ItemListView: View {
@Environment(\.source)
private var source: Source

@FetchRequest(fetchRequest: Requests.fetchItems())
var items: FetchedResults<Item>

Expand Down
3 changes: 1 addition & 2 deletions PocketKit/Sources/PocketKit/PocketSceneCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ class PocketSceneCoordinator {

private func configureSplitView() {
let listView = ItemListView(
context: source.managedObjectContext,
selection: itemSelection
)
).environment(\.managedObjectContext, source.managedObjectContext)

let primaryViewController = UIHostingController(rootView: listView)
let secondaryViewController = ItemViewController(
Expand Down

0 comments on commit 0955be4

Please sign in to comment.