Skip to content

lonkly/SwiftUI-Flows

Repository files navigation

SwiftUI Flows

Simulator Screen Recording - iPhone 14 - 2023-10-02 at 21 46 04

🚀 SwiftUIFlows: Ultimate Navigation for Apple Ecosystem 🍎

Seamlessly present modal screens, popups, and more in SwiftUI, across iOS and Mac!

📱 What Can SwiftUIFlows Do?

  • Full-screen Displays: Dive into immersive content.
  • Sheet-styled Modals: Classic, yet elegant.
  • Custom-sized Modals: Your size, your rules.
  • Popovers: The cherry on top for contextual info.

🌟 Why Choose SwiftUIFlows?

  • Declarative & Clean: Say goodbye to scattered navigation logic and constant flag checking, like @State private var isPresentingMyScreen = false.
  • Streamlined Flows: Easy-to-write navigation flows that save you time and reduce boilerplate. No more manual callbacks and dismissals.
  • Multiple Modals: Show any number of modals in a view, and control their presentation and dismissal with ease.
  • Custom Popups: Design and present popups as unique as your app.

💡 Features At A Glance:

  • Light & Swift: Zero dependencies. Built with the KISS (Keep It Simple, Stupid) principle.
  • Cross-Platform: Designed for both iOS and Mac.
  • Supercharged Fullscreen & Popups: Uses ZStack for native, enhanced presentations.
  • Limitless Customization: Style it, modify it, make it yours.

Simple FlowBuilder Example:

@MainActor class ExampleFlow: FlowBuilder {
    func presentSomePopup()  {
         presentPopup(Example1View(showDismiss: true, flow: self))
    }

    func presentFullScreen()  {
         presentFullScreen(Example2View(showDismiss: true, flow: self))
    }

    func presentAnotherPopup()  {
         presentPopup(Example3View(showDismiss: true, flow: self))
    }
}

Usage Example:

     flow.presentSomePopup() // popup
     flow.presentFullScreen() // full-screen
     flow.presentAnotherPopup() // another popup
}

More Avdanced FlowBuilder Example:

import SwiftUIFlows

@MainActor class RootFlow: FlowBuilder {
    
    func showVerified(viewModel: AuthVM)  {
         presentFullScreen(
            VerifiedView(viewModel: viewModel, completion: { [weak self] in
                self?.dismissFullScreen()
            })
        )
    }
    
    func showAnythingYouWant(view: AnyView)  {
         presentFullScreen(
            view
                .onAppear {
                        self.dismissFullScreen()
                }
        )
    }
}

Projects already using SwiftUI-Flows:

Stakes

Contributions and feature requests are welcome!

About

SwiftUI Native FullScreen, Sheet, Popover presentation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages