Skip to content

Add runnable examples for DrMaxNavigation - #6

Open
lhoracek wants to merge 2 commits into
mainfrom
feature/examples
Open

Add runnable examples for DrMaxNavigation#6
lhoracek wants to merge 2 commits into
mainfrom
feature/examples

Conversation

@lhoracek

@lhoracek lhoracek commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a runnable iOS app (Examples/DrMaxNavigationDemo.swiftpm) and a native macOS app (Examples/DrMaxNavigationDemoMac) demonstrating the library.
  • Shared demo code (screens, coordinators, views) lives in Examples/DrMaxNavigationDemoCore, consumed by both apps to avoid duplication.
  • Demonstrates push/sheet/popover/cover navigation styles and composing independent "feature" modules via pullback(on:), matching the patterns described in the README.
  • README updated with an "Examples" section pointing at all three packages, including a note that the .swiftpm iOS app does not open in Apple's separate Swift Playgrounds app (that app bundles an older, incompatible Swift toolchain).

Test plan

  • xcodebuild build -scheme DrMaxNavigationDemo -destination 'platform=iOS Simulator,name=iPhone 17 Pro' succeeds
  • iOS app installed and launched on simulator; home screen verified via screenshot
  • swift build / running the binary succeeds for DrMaxNavigationDemoMac
  • swift test on the main package still passes (49/49), unaffected by these changes

🤖 Generated with Claude Code

Luboš Horáček and others added 2 commits September 3, 2026 14:28
Adds an iOS app (DrMaxNavigationDemo.swiftpm) and a native macOS app
(DrMaxNavigationDemoMac), both wrapping a shared demo package
(DrMaxNavigationDemoCore) so the push/sheet/popover/cover navigation
styles and feature composition via pullback(on:) can be tried
interactively instead of just read about in the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
NavigationStack on macOS sizes navigationDestination content to its
ideal size and doesn't paint an opaque background behind it, unlike
UINavigationController on iOS. A destination that doesn't already fill
and paint its own background (e.g. the Counter demo's plain VStack)
renders small, centered, and see-through over the previous screen.

Sheets/popovers already had the equivalent workaround via
presentationBackground(.background); push was missing it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lhoracek

lhoracek commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author
01-home 02-push 03-sheet 03-sheet 05-cover-settings

@lhoracek

lhoracek commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author
image image image image image

public let controller = RootNavigationController<AppScreen>(root: .home)

private(set) var counterCoordinator: CounterCoordinator?
private(set) var settingsCoordinator: SettingsCoordinator?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems wrong. If only one of them being shown is valid, it should be an enum.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also this seems to me like it adds additional complexity to the example without really showcasing any of the library functionality, so I would drop this.

public final class CounterCoordinator: Hashable {
let controller: NavigationController<AppScreen, CounterScreen>

private(set) var count = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure what this count showcases as a library functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants