Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some AnyView in the List implementation #246

Merged
merged 1 commit into from
Aug 4, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Sources/TokamakCore/Views/Containers/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public struct List<SelectionValue, Content>: View
}
}))
}
return AnyView(_ListRow.buildItems(sections) { (view, isLast) -> AnyView in
return AnyView(_ListRow.buildItems(sections) { view, isLast in
if let section = view.view as? SectionView {
return AnyView(section.listRow(style))
section.listRow(style)
} else {
return AnyView(_ListRow.listRow(view, style, isLast: isLast))
_ListRow.listRow(view, style, isLast: isLast)
}
})
} else {
Expand All @@ -83,21 +83,21 @@ public struct List<SelectionValue, Content>: View

public var body: some View {
if let style = style as? ListStyleDeferredToRenderer {
return style.listBody(ScrollView {
style.listBody(ScrollView {
HStack {
Spacer()
}
listStack
.environment(\._outlineGroupStyle, _ListOutlineGroupStyle())
})
} else {
return AnyView(ScrollView {
ScrollView {
HStack {
Spacer()
}
listStack
.environment(\._outlineGroupStyle, _ListOutlineGroupStyle())
})
}
}
}
}
Expand All @@ -111,7 +111,7 @@ public struct _ListRow {
HStack {
Spacer()
}
AnyView(rowView(view, offset == children.count - 1))
rowView(view, offset == children.count - 1)
}
}
}
Expand Down