Swimbi: The Fast Swift Menu Builder for iOS Developers
Creating intuitive, responsive navigation is essential for modern iOS apps. Swimbi is a lightweight Swift menu builder designed to help developers add polished, customizable menus quickly — without wrestling with complex setup or heavy frameworks. This guide explains what Swimbi offers, how to integrate it, and practical patterns for using it in real apps.
Why choose Swimbi
- Speed: Minimal setup lets you add menus in minutes.
- Lightweight: Small footprint with no heavy dependencies.
- Customizable: Easy styling, animations, and layout options.
- Swift-native: Uses Swift idioms and integrates well with SwiftUI and UIKit projects.
Key features
- Multiple menu types: side drawers, context menus, and bottom sheets.
- Built-in animation presets (fade, slide, scale) with adjustable timing.
- Theming: colors, fonts, spacing, and icons configurable via a single struct.
- Accessibility-ready: supports VoiceOver labels and dynamic type.
- Declarative API compatible with SwiftUI and a simple imperative API for UIKit.
Quick integration (Swift Package Manager)
- In Xcode choose File > Add Packages…
- Enter the Swimbi repository URL (assume: https://github.com/example/swimbi).
- Add the package to your app target.
Basic usage (UIKit)
swift
import Swimbi // Create menu items let items = [ SwimbiItem(title: “Home”, icon: UIImage(systemName: “house”)), SwimbiItem(title: “Profile”, icon: UIImage(systemName: “person”)), SwimbiItem(title: “Settings”, icon: UIImage(systemName: “gear”)) ] // Configure and present a side menu let menu = SwimbiMenu(items: items) menu.theme.backgroundColor = .systemBackground menu.present(from: self) // presents from current view controller
Basic usage (SwiftUI)
swift
import Swimbi import SwiftUI struct ContentView: View { @State private var showingMenu = false var body: some View { ZStack { MainContent() if showingMenu { SwimbiView(items: menuItems, isPresented: $showingMenu) .transition(.move(edge: .leading)) } } } }
Theming and customization
- Use a Theme struct to set global styles:
- colors: background, tint, itemText
- typography: font sizes, weights
- spacing: padding, item height
- Override animations per presentation (ease-in/out, duration, delay).
- Provide custom item views for complex layouts (badges, toggles).
Accessibility & Localization
- Set item accessibilityLabel and accessibilityHint.
- Support Dynamic Type by using scalable fonts in the theme.
- Localize titles and VoiceOver hints via NSLocalizedString.
Performance tips
- Reuse menu instances when possible to avoid re-creating views.
- Load heavy assets (images) lazily.
- Prefer simple transitions on low-end devices; reduce blur and shadow intensity.
Common use patterns
- Primary navigation: side drawer for feature-rich apps.
- Quick actions: long-press context menus for items.
- Onboarding: bottom sheet menu for step selection.
- Settings: grouped list with section headers and switches.
Example: Context menu with callbacks
swift
let items = [ SwimbiItem(title: “Edit”) { /* edit action / }, SwimbiItem(title: “Delete”) { / delete action */ } ] let context = SwimbiContextMenu(items: items) context.present(from: view)
Troubleshooting
- Menu not appearing: ensure present(from:) is called on the visible view controller.
- Animation stutters: check for heavy work on the main thread during presentation.
- VoiceOver issues: confirm accessibility labels are set and elements are hittable.
Conclusion
Swimbi streamlines adding flexible, accessible menus to iOS apps with minimal code. Its Swift-native API, theming, and performance-conscious design make it a practical choice for developers who want fast results and a polished user experience.
If you want, I can generate sample projects (UIKit or SwiftUI), a full API reference, or themed code snippets for a specific app layout.
Leave a Reply