2020-03-02a few seconds read (About 56 words)How to return VStack or HStack in SwiftUIIssue #613 12345678910111213141516171819202122232425struct VOrH<Content>: View where Content: View { let isVertical: Bool let content: () -> Content init(isVertical: Bool, @ViewBuilder content: @escaping () -> Content) { self.isVertical = isVertical self.content = content } var body: some View { makeContent() } private func makeContent() -> some View { if isVertical { return VStack(spacing: 0) { content() }.eraseToAnyView() } else { return HStack(spacing: 0) { content() }.eraseToAnyView() } }}#swiftUI