PresentationKit

1.5.0

Value-based navigation and alert, modal, popover, sheet, and toast presentation in SwiftUI.
danielsaidi/PresentationKit

What's New

2026-08-04T11:43:11Z

This version adds popover support.

✨ Features

  • The .popover(for:...) view extension can be used to present popovers.

Project Icon

Version Swift 6.1 Documentation MIT License

PresentationKit

PresentationKit is a SwiftUI library that makes it easy to present alerts, sheets, full screen covers, and toasts for any model, using an observable Presentation class.

Demo Gif

Installation

PresentationKit can be installed with the Swift Package Manager:

https://github.com/danielsaidi/PresentationKit.git

Supported Platforms

PresentationKit supports iOS 17, tvOS 17, macOS 14, watchOS 10, and visionOS 1.

Getting Started

PresentationKit has features for value-based navigation and presentation, and lets you present alerts, covers, popovers, sheets, and toasts in the same way. See the documentation for more information.

Navigation

The Navigation class can be used to perform value-based navigation.

struct MyView: View {

    @State var navigation = Navigation()

    var body: some View {
        NavigationStack(path: $navigation.path) {
            Button("Push view") {
                navigation.push("detail")
            }
            .navigationDestination(for: String.self) { value in
                Text(value)
            }
        }
    }
}

Types that implement the NavigationDestination protocol can be used to create a NavigationStack for that specific type.

See the Navigation article for more information.

Presentation

The Presentation class can be used to perform value-based presentation of alerts, modals, sheets, popovers, and toasts.

struct MyView: View {

    // In this example, consider there are enums for the various content types. 
    
    @State var alert = Presentation<MyAlert>()
    @State var cover = Presentation<MyModal>()
    @State var popover = Presentation<MyPopover>()
    @State var sheet = Presentation<MyModal>()
    @State var toast = Presentation<MyToast>()
    
    var body: some View {
        Button("Perform presentation") {
            alert.present(.someAlert)       // or
            cover.present(.someModal)       // or
            popover.present(.somePopover)   // or
            sheet.present(.someModal)       // or
            sheet.present(.someToast)
        }
        .alert(for: $alert) { alert in
            // Present an AlertMessage for the alert
        }
        #if !os(macOS)
        .fullScreenCover(for: $cover) { cover in
            // Present a view for the full screen cover
        }
        #endif
        .popover(for: $popover) { popover in
            // Present a view for the popover
        }
        .sheet(for: $sheet) { sheet in
            // Present a view for the sheet
        }
        .toast(for: $toast) { toast in
            // Present a view for the toast
        }
    }
}

Each modifier supports the same customizations as the native modifiers. For instance, sheets can define a dismiss action, popovers can define an arrow direction, toasts can define an edge, etc.

PresentationKit also adds additional support to each content type. For instance, alerts can be used to automatically alert async errors, a sheets can be resized with animations, etc.

See the Presentation article and the separate content type articles for more information.

Documentation

The online documentation has more information, articles, code examples, etc.

Demo Application

The Demo folder has a demo app that lets you explore the library.

Support My Work

You can become a sponsor to help me dedicate more time on my various open-source tools. Every contribution, no matter the size, makes a real difference in keeping these tools free and actively developed.

Contact

Feel free to reach out if you have questions, or want to contribute in any way:

License

PresentationKit is available under the MIT license. See the LICENSE file for more info.

Description

  • Swift Tools 6.1.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue Aug 04 2026 22:54:23 GMT-0900 (Hawaii-Aleutian Daylight Time)