Methods for running the PersistentBackgroundNavigation demonstration:
Using Xcode's preview system:
-
Open the package in Xcode:
open Package.swift
-
Navigate to
Sources/SeaBearKit/Navigation/PersistentBackgroundNavigation.swift -
Open the Canvas (⌥⌘↩ or Editor → Canvas)
-
You'll see three interactive previews:
- "Gradient Background" - Shows built-in color palette gradients
- "Custom Background" - Shows custom view backgrounds (grid pattern example)
- "Minimal Background" - Shows minimal mode with system background only
-
Click the "Live Preview" button to interact with the navigation and test deep navigation
Creating a standalone application with full demo features:
-
Create a new iOS App in Xcode:
- File → New → Project
- Choose "iOS" → "App"
- Product Name: "SeaBearKitDemo"
- Interface: SwiftUI
- Language: Swift
-
Add the SeaBearKit package:
- File → Add Package Dependencies
- Enter local path:
/Users/kh/Projects/github.com/seabearDEV/SeaBearKit - Add to project
-
Replace the app file content with the demo code from:
Sources/Demo/DemoApp.swift -
Run on simulator or device (⌘R)
Swift Playground implementation:
import SwiftUI
import SeaBearKit
import PlaygroundSupport
struct ContentView: View {
var body: some View {
PersistentBackgroundNavigation(palette: .sunset) {
List {
NavigationLink("Screen 1") {
DetailView(title: "Screen 1")
}
NavigationLink("Screen 2") {
DetailView(title: "Screen 2")
}
NavigationLink("Screen 3") {
DetailView(title: "Screen 3")
}
}
.navigationTitle("Demo")
}
}
}
struct DetailView: View {
let title: String
var body: some View {
VStack {
Text(title)
.font(.largeTitle)
Text("Notice the persistent background!")
.padding()
NavigationLink("Go Deeper") {
DetailView(title: "\(title) > Detail")
}
}
.navigationTitle(title)
.containerBackground(for: .navigation) {
Color.clear
}
}
}
PlaygroundPage.current.setLiveView(ContentView())Key behaviors to observe:
- Consistent Rendering: Background gradient maintains consistency during screen transitions
- Transition Quality: Navigation animations execute without visual artifacts
- Palette Transitions: Color palette changes animate smoothly
- Configuration Modes: Standard (gradient) and Minimal (system background) options available
- Material Integration: System Lists and Forms adopt Liquid Glass materials over the gradient layer
Standard NavigationStack background approach:
// Standard approach (inconsistent during navigation)
ZStack {
LinearGradient(...)
NavigationStack {
ContentView()
}
}SeaBearKit approach:
// Consistent rendering implementation
PersistentBackgroundNavigation(palette: .sunset) {
ContentView()
}The architectural difference ensures consistent rendering during navigation transitions.