diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d56b77522..58d48af1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,8 +27,8 @@ jobs: matrix: include: - { toolchain: wasm-5.6.0-RELEASE } - - { toolchain: wasm-5.7-SNAPSHOT-2022-06-01-a } - - { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-06-23-a } + - { toolchain: wasm-5.7-SNAPSHOT-2022-07-27-a } + - { toolchain: wasm-DEVELOPMENT-SNAPSHOT-2022-07-23-a } steps: - uses: actions/checkout@v2 @@ -85,7 +85,7 @@ jobs: shell: bash run: | set -ex - sudo xcode-select --switch /Applications/Xcode_13.4.app/Contents/Developer/ + sudo xcode-select --switch /Applications/Xcode_13.4.1.app/Contents/Developer/ brew install gtk+3 @@ -94,7 +94,7 @@ jobs: gtk_ubuntu_18_04_build: runs-on: ubuntu-latest container: - image: swiftlang/swift:nightly-bionic + image: swiftlang/swift:nightly-5.7-bionic steps: - uses: actions/checkout@v2 @@ -109,7 +109,7 @@ jobs: gtk_ubuntu_20_04_build: runs-on: ubuntu-latest container: - image: swiftlang/swift:nightly-focal + image: swiftlang/swift:nightly-5.7-focal steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index bfe844cd9..5b7dcc59f 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -8,26 +8,26 @@ on: jobs: codecov: container: - image: swiftlang/swift:nightly-focal + image: swiftlang/swift:nightly-5.7-focal runs-on: ubuntu-latest steps: - - run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0 - - name: Checkout Branch - uses: actions/checkout@v2 - - name: Build Test Target - run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests - - name: Run Tests - run: swift test --enable-code-coverage --skip-build - - name: Generate Branch Coverage Report - uses: mattpolzin/swift-codecov-action@0.7.1 - id: cov - with: - MINIMUM_COVERAGE: 15 - - name: Post Positive Results - if: ${{ success() }} - run: | - echo "::warning file=Package.swift,line=1,col=1::The current code coverage percentage is passing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." - - name: Post Negative Results - if: ${{ failure() }} - run: | - echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." + - run: apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y gtk+-3.0 libgtk+-3.0 + - name: Checkout Branch + uses: actions/checkout@v2 + - name: Build Test Target + run: swift build -Xswiftc -profile-coverage-mapping -Xswiftc -profile-generate --product TokamakPackageTests + - name: Run Tests + run: swift test --enable-code-coverage --skip-build + - name: Generate Branch Coverage Report + uses: mattpolzin/swift-codecov-action@0.7.1 + id: cov + with: + MINIMUM_COVERAGE: 15 + - name: Post Positive Results + if: ${{ success() }} + run: | + echo "::warning file=Package.swift,line=1,col=1::The current code coverage percentage is passing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." + - name: Post Negative Results + if: ${{ failure() }} + run: | + echo "::error file=Package.swift,line=1,col=1::The current code coverage percentage is failing with ${{ steps.cov.outputs.codecov }} (minimum allowed: ${{ steps.cov.outputs.minimum_coverage }}%)." diff --git a/Sources/TokamakCore/Fiber/Layout/StackLayout.swift b/Sources/TokamakCore/Fiber/Layout/StackLayout.swift index 4edacae5c..85a6d22e9 100644 --- a/Sources/TokamakCore/Fiber/Layout/StackLayout.swift +++ b/Sources/TokamakCore/Fiber/Layout/StackLayout.swift @@ -261,30 +261,8 @@ extension VStack: StackLayout { public var _alignment: Alignment { .init(horizontal: alignment, vertical: .center) } } -public extension VStack where Content == EmptyView { - init( - alignment: HorizontalAlignment = .center, - spacing: CGFloat? = nil - ) { - self.alignment = alignment - self.spacing = spacing - content = EmptyView() - } -} - @_spi(TokamakCore) extension HStack: StackLayout { public static var orientation: Axis { .horizontal } public var _alignment: Alignment { .init(horizontal: .center, vertical: alignment) } } - -public extension HStack where Content == EmptyView { - init( - alignment: VerticalAlignment = .center, - spacing: CGFloat? = nil - ) { - self.alignment = alignment - self.spacing = spacing - content = EmptyView() - } -} diff --git a/Sources/TokamakCore/Views/Containers/List/List.swift b/Sources/TokamakCore/Views/Containers/List/List.swift index bbe9009dc..75a2e1835 100644 --- a/Sources/TokamakCore/Views/Containers/List/List.swift +++ b/Sources/TokamakCore/Views/Containers/List/List.swift @@ -39,46 +39,48 @@ public struct List: View self.content = content() } - var listStack: some View { - VStack(alignment: .leading, spacing: 0) { () -> AnyView in - if let contentContainer = content as? ParentView { - var sections = [AnyView]() - var currentSection = [AnyView]() - for child in contentContainer.children { - if child.view is SectionView { - if currentSection.count > 0 { - sections.append(AnyView(Section { - ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view } - })) - currentSection = [] - } - sections.append(child) - } else { - if child.children.count > 0 { - currentSection.append(contentsOf: child.children) - } else { - currentSection.append(child) - } + func stackContent() -> AnyView { + if let contentContainer = content as? ParentView { + var sections = [AnyView]() + var currentSection = [AnyView]() + for child in contentContainer.children { + if child.view is SectionView { + if currentSection.count > 0 { + sections.append(AnyView(Section { + ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view } + })) + currentSection = [] } - } - if currentSection.count > 0 { - sections.append(AnyView(Section { - ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view } - })) - } - return AnyView(_ListRow.buildItems(sections) { view, isLast in - if let section = view.view as? SectionView { - section.listRow(style) + sections.append(child) + } else { + if child.children.count > 0 { + currentSection.append(contentsOf: child.children) } else { - _ListRow.listRow(view, style, isLast: isLast) + currentSection.append(child) } - }) - } else { - return AnyView(content) + } } + if currentSection.count > 0 { + sections.append(AnyView(Section { + ForEach(Array(currentSection.enumerated()), id: \.offset) { _, view in view } + })) + } + return AnyView(_ListRow.buildItems(sections) { view, isLast in + if let section = view.view as? SectionView { + section.listRow(style) + } else { + _ListRow.listRow(view, style, isLast: isLast) + } + }) + } else { + return AnyView(content) } } + var listStack: some View { + VStack(alignment: .leading, spacing: 0, content: stackContent) + } + @_spi(TokamakCore) public var body: some View { if let style = style as? ListStyleDeferredToRenderer {