Skip to content

A lightweight SwiftUI library that allows users to send feedback via email.

License

Notifications You must be signed in to change notification settings

psalzAppDev/PSFeedbackManager

Repository files navigation

PSFeedbackManager

A lightweight SwiftUI library that allows users to send feedback via email.

This a SwiftUI re-write of SwiftyFeedback.

It works on iOS, iPadOS, macOS (Designed for iPad) and macCatalyst with version 16.0 or higher. Now works on macOS, too!

Contents

Requirements

  • iOS 16.0+
  • iPadOS 16.0+
  • Mac Catalyst 16.0+
  • macOS 13.0+
  • Xcode 15.0+
  • Swift 5.10+

Installation

To add a package dependency to your Xcode project, select File > Add Package and enter this repository's URL (https://github.com/psalzAppDev/PSFeedbackManager).

To add a package dependency to Swift Package, add this repository to your list of dependencies.

.package(url: "https://github.com/psalzAppDev/PSFeedbackManager", from: Version(1, 1, 0))

Usage

The feedback manager creates an email message containing the selected topic (question, request, bug report, or other), the user's message, up to 5 optional image attachments, device info (model name and OS version), and app info (app name, version, and build).

If available, MFMailComposeViewController is used to display the email to the user. The user can then change the contents of the message at will before sending.

If MFMailComposeViewController is not available, the feedback manager will try to open the default mail app to send an email. In this case, no image attachments can be sent.

If this fails as well, an error message is shown explaining that this device can't send emails.

The feedback manager can be displayed modally as a SwiftUI sheet, or non-modally, for example as a detail view in a NavigationStack.

In the latter case, add isModal: false to the configuration.

import SwiftUI
import PSFeedbackManager

struct ContentView: View {

    @State
    private var showFeedbackManager = false

    let recipients = ["[email protected]"]

    var body: some View {
        
        NavigationStack {

            VStack {
                Spacer()

                Button("Show Feedback Manager Modally") {
                    showFeedbackManager = true
                }

                Spacer()

                // Show Feedback Manager as detail view (non-modally).
                NavigationLink("Show Feedback Manager non-modally") {
                    FeedbackManagerView(
                        configuration: .init(
                            isModal: false,
                            recipients: recipients
                        )
                    )
                }

                Spacer()
            }
            .padding()
            .navigationTitle("FeedbackManager Demo")
            .navigationBarTitleDisplayMode(.large)
        }
        .sheet(isPresented: $showFeedbackManager) {
            NavigationStack {
                FeedbackManagerView(configuration: .init(recipients: recipients))
            }
        }
    }
}

Localization is available for the following languages:

  • English
  • German
  • Spanish
  • French
  • Italian
  • Dutch
  • Portuguese
  • Russian
  • Swedish

Any help improving the localizations is warmly appreciated!

License

Distributed under the MIT license. See LICENSE for more information.

About

A lightweight SwiftUI library that allows users to send feedback via email.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages