Skip to content

Comments

feat: add cross-platform BottomActionBar and TopActionBar components#455

Merged
MarcHidalgo5 merged 3 commits intodevelopfrom
new-bottom-action-bar
Feb 23, 2026
Merged

feat: add cross-platform BottomActionBar and TopActionBar components#455
MarcHidalgo5 merged 3 commits intodevelopfrom
new-bottom-action-bar

Conversation

@MarcHidalgo5
Copy link
Contributor

@MarcHidalgo5 MarcHidalgo5 commented Feb 22, 2026

✨ Add cross-platform bottomActionBar and topActionBar

This PR introduces cross-platform bottomActionBar and topActionBar extensions for SwiftUI.View.

These components allow adding action bars at the top or bottom of a view in a clean and reusable way, with platform-specific implementations for iOS and Android.


🧩 Implementation Details

iOS

  • Uses native SwiftUI view modifiers.
  • Overlays buttons using safe area insets.
  • Fully native SwiftUI behavior.

Android

  • Uses Compose UI components.
  • Integrates action bars at the appropriate layout positions.
  • Maintains platform consistency while preserving shared API usage.

🔍 Previews

Previews have been added for both Top Button and Bottom Button configurations to demonstrate usage in SwiftUI previews.

This enhancement improves UI consistency and cross-platform interoperability.


🚀 API Usage Examples

Bottom Action Bar

.bottomActionBar {
    AsyncButton("Continue") {
        try await Task.sleep(for: .seconds(1))
    }
}

Top Action Bar

.topActionBar {
    AsyncButton("Continue") {
        try await Task.sleep(for: .seconds(1))
    }
}

📱 Top Bar Comparison

iOS Android

📱 Bottom Bar Comparison

iOS Android

Introduce cross-platform `bottomActionBar` and `topActionBar` extensions
for SwiftUI View. These components allow you to easily add action bars
at the top or bottom of a UI view, supporting both iOS and Android platforms
with platform-specific implementations.

For iOS, utilize SwiftUI's view modifiers to overlay buttons with
safe area insets. For Android, employ Compose UI components to integrate
the action bars at appropriate positions.

Add previews for `Top Button` and `Bottom Button` configurations to
demonstrate the usage of these new action bars in SwiftUI previews. This
enhancement improves UI consistency and interoperability across platforms.
Rename `BottomActionBar.swift` to `ActionBar.swift` and move it from
the `Extensions` directory to `ViewModifiers` to better reflect its purpose
and usage. Remove duplicate code by unifying `bottomActionBar` and
`topActionBar` implementations into a single flexible method `actionBarInset`.
This change improves code maintainability and readability by eliminating
redundant extensions and consolidating platform-specific logic.
Wrap the `actionBarInset` method with an `#if os(iOS) || os(macOS)`
directive to ensure this private function is only included on iOS
and macOS platforms. This change keeps the codebase platform-specific,
making it maintainable and preventing unnecessary compilation on
unsupported platforms like Android. It also aligns with the pattern
used for the `AndroidActionBarScaffold`, improving consistency.
Copy link
Contributor

@piercifani piercifani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congrats on shipping

@MarcHidalgo5 MarcHidalgo5 merged commit 5713a41 into develop Feb 23, 2026
3 checks passed
@MarcHidalgo5 MarcHidalgo5 deleted the new-bottom-action-bar branch February 23, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants