-MijickPopups is a free and open-source library dedicated for SwiftUI that makes the process of presenting popups easier and much cleaner.
-* **Improves code quality.** Show your popup using the `present()` method.
- Hide with `dismissLastPopup()`. Simple as never.
-* **Create any popup.** We know how important customisation is; that's why we give you the opportunity to design your popup in any way you like.
-* **Designed for SwiftUI.** While developing the library, we have used the power of SwiftUI to give you powerful tool to speed up your implementation process.
-
-
-
-# Getting Started
-### ✋ Requirements
-
-| **Platforms** | **Minimum Swift Version** |
-|:----------|:----------|
-| iOS 14+ | 6.0 |
-| iPadOS 14+ | 6.0 |
-| macOS 12+ | 6.0 |
-| tvOS 15+ | 6.0 |
-| watchOS 4+ | 6.0 |
-| visionOS 1+ | 6.0 |
-
-### ⏳ Installation
-
-#### [Swift Package Manager][spm]
-Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the Swift compiler.
-
-Once you have your Swift package set up, adding MijickPopups as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
-
-```Swift
-dependencies: [
- .package(url: "https://github.com/Mijick/Popups.git", branch(“main”))
-]
-```
-
-#### [Cocoapods][cocoapods]
-Cocoapods is a dependency manager for Swift and Objective-C Cocoa projects that helps to scale them elegantly.
-
-Installation steps:
-- Install CocoaPods 1.10.0 (or later)
-- [Generate CocoaPods][generate_cocoapods] for your project
-```Swift
- pod init
-```
-- Add CocoaPods dependency into your `Podfile`
-```Swift
- pod 'MijickPopups'
-```
-- Install dependency and generate `.xcworkspace` file
-```Swift
- pod install
-```
-- Use new Xcode project file `.xcworkspace`
-
-
-# Usage
-### 1. Setup library
-The library can be initialised in either of two ways:
-1. **DOES NOT WORK with SwiftUI sheets** Inside your @main structure call the `registerPopups()` method. It takes the optional argument - `configBuilder`, that can be used to configure some modifiers for all popups in the application.
-```Swift
-@main struct App_Main: App {
- var body: some Scene { WindowGroup {
- ContentView()
- .registerPopups { config in config
- .vertical { $0
- .enableDragGesture(true)
- .tapOutsideToDismissPopup(true)
- .cornerRadius(32)
- }
- .centre { $0
- .tapOutsideToDismissPopup(false)
- .backgroundColor(.white)
- }
- }
- }}
-}
-```
-2. **WORKS with SwiftUI sheets. Only for iOS**
-Declare an AppDelegate class conforming to UIApplicationDelegate and add it to the @main structure.
-```Swift
-@main struct App_Main: App {
- @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
-
-
- var body: some Scene { WindowGroup(content: ContentView.init) }
-}
+
+
+
+
+
Popups
+
Alerts
+
Resizable Sheets
+
Banners
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-class AppDelegate: NSObject, UIApplicationDelegate {
- func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
- let sceneConfig = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
- sceneConfig.delegateClass = CustomPopupSceneDelegate.self
- return sceneConfig
- }
-}
-
-
-class CustomPopupSceneDelegate: PopupSceneDelegate {
- override init() { super.init()
- configBuilder = { $0
- .vertical { $0
- .enableDragGesture(true)
- .tapOutsideToDismissPopup(true)
- .cornerRadius(32)
- }
- .centre { $0
- .tapOutsideToDismissPopup(false)
- .backgroundColor(.white)
- }
- }
- }
-}
-```
-
-### 2. Declare a structure of your popup
-The library provides an ability to present your custom view in three predefinied places - **Top**, **Centre** and **Bottom**.
-In order to present it, it is necessary to confirm to one of the protocols during your view declaration:
-- `TopPopup` - presents popup view from the top
-- `CentrePopup` - presents popup view from the center
-- `BottomPopup` - presents popup view from the bottom
-
-So that an example view you want to present will have the following declaration:
-```Swift
-struct BottomCustomPopup: BottomPopup {
- ...
-}
-```
-
-### 3. Declare `body` variable
-The variable above declares the design of the popup.
-```Swift
-struct BottomCustomPopup: BottomPopup {
- var body: some View {
- HStack(spacing: 0) {
- Text("Witaj okrutny świecie")
- Spacer()
- Button(action: dismiss) { Text("Dismiss") }
- }
- .padding(.vertical, 20)
- .padding(.leading, 24)
- .padding(.trailing, 16)
- }
- ...
-}
-```
+
+
-### 4. Implement `configurePopup(config: Config) -> Config` method
-*Declaring this step is optional - if you wish, you can skip this step and leave the UI configuration to us.*
-Each protocol has its own set of methods that can be used to create a unique appearance for every popup.
-```Swift
-struct BottomCustomPopup: BottomPopup {
- var body: some View {
- HStack(spacing: 0) {
- Text("Witaj okrutny świecie")
- Spacer()
- Button(action: dismiss) { Text("Dismiss") }
- }
- .padding(.vertical, 20)
- .padding(.leading, 24)
- .padding(.trailing, 16)
- }
- func configurePopup(config: BottomPopupConfig) -> BottomPopupConfig {
- config
- .horizontalPadding(20)
- .bottomPadding(42)
- .cornerRadius(16)
- }
- ...
-}
-```
+
+# ☀️ Why MijickPopups?
+MijickPopups solves two seemingly contradictory problems - to allow developers to create fully customizable popup, and to make the process as simple as possible. Here is why we think we have successfully met these objectives:
-### 5. Present your popup from any place you want!
-Just call `BottomCustomPopup().present()` from the selected place. Popup can be closed automatically by adding the `dismissAfter()` modifier.
-```Swift
-struct SettingsViewModel {
- ...
- func saveSettings() {
- ...
- BottomCustomPopup()
- .dismissAfter(5)
- .present()
- ...
- }
- ...
-}
-```
+
+
The power of a single line of code
+
For your convenience and to enhance code clarity, we have consolidated all the key actions into a single line of code.
+
+
-### 6. Closing popups
-There are two methods to do so:
-- By calling one of the methods `dismissLastPopup`, `dismissPopup(_ type: Popup.Type)`, `dismissPopup(_ id: String)`, `dismissAllPopups` inside the popup you created
-```Swift
-struct BottomCustomPopup: BottomPopup {
- ...
- func createButton() -> some View {
- Button(action: dismissLastPopup) { Text("Tap to close") }
- }
- ...
-}
-```
-- By calling one of three static methods of PopupManager:
- - `PopupManager.dismissLastPopup()`
- - `PopupManager.dismissPopup(_ type: Popup.Type)` where popup is the popup you want to close
- - `PopupManager.dismissPopup(_ id: String)` where ID is the ID of the popup you want to close
- - `PopupManager.dismissAllPopups()`
-
-
+
+
Tailored to your needs. Designed to suit your preferences
+
Developers have various programming styles, and we understand and respect that. Therefore, our framework is engineered in such a way that you can open or close a popup from anywhere in your code.
+
+
-### Postscript
-The framework has extensive documentation built in, so in case of any problems, please use the Xcode Quick Help 😉
+
+
Engineered for limitless creativity
+
The framework was developed not to limit your creativity; we give you the freedom to experiment with the appearance of your popups.
+
+
-# Try our demo
-See for yourself how does it work by cloning [project][Demo] we created
+
+
Three in one
+
You can display popups created with our framework in one of three positions on the screen: at the bottom, in the center, or at the top. This allows you to create the most common objects, including popups, popovers, alerts, notifications, and more.
+
+
-# License
-MijickPopups is released under the Apache License 2.0. See [LICENSE][License] for details.
+
+
Multiple popups? No problem!
+
Whether you want to present multiple notifications to the user, or show terms and conditions before they log in, the framework makes it possible - it allows you to keep as many popups on the screen as you want. Inactive popups are stacked in a visually appealing way.
+
+
-
+
+
Past, present and future
+
We decided to reach out to developers who, for various reasons, want to use native sheets and alerts alongside our framework. From now on, this is possible, and in the near future, we will also add the ability to call sheets in a native style, allowing you to integrate our framework into your existing projects as well.
+
+
-# Our other open source SwiftUI libraries
-[NavigationView] - Easier and cleaner way of navigating through your app
-
-[CalendarView] - Create your own calendar object in no time
-
-[GridView] - Lay out your data with no effort
-
-[CameraView] - The most powerful CameraController. Designed for SwiftUI
-
-[Timer] - Modern API for Timer
+### There is much more besides:
+- The height of the popup adapts to its content, or can be defined by you.
+- Popups can be automatically dismissed after a certain period of time.
+- Drag gesture can be used to resize the popup, according to the provided indentations.
+- Works with multiple windows.
+- Supports all Apple platforms.
+- ... and much more.
-[SPM]: https://www.swift.org/package-manager
+
+# 🚀 How to use it?
+Visit the framework's [documentation page](https://link.mijick.com/popups-wiki) to learn how to integrate your project with **MijickPopups**.
-[Demo]: https://github.com/Mijick/Popups-Demo
-[License]: https://github.com/Mijick/Popups/blob/main/LICENSE
+
+# 🍀 Community
+Join the welcoming community of developers on [Discord](https://link.mijick.com/discord).
-[spm]: https://www.swift.org/package-manager/
-[cocoapods]: https://cocoapods.org/
-[generate_cocoapods]: https://github.com/square/cocoapods-generate
+
+# 🌼 Contribute
+To contribute a feature or idea to **MijickPopups**, create an [issue](https://github.com/Mijick/Popups/issues/new?assignees=FulcrumOne&labels=state%3A+inactive%2C+type%3A+feature&projects=&template=🚀-feature-request.md&title=%5BFREQ%5D) explaining your idea or bring it up on [Discord](https://discord.com/invite/dT5V7nm5SC).
+If you find a bug, please create an [issue](https://github.com/Mijick/Popups/issues/new?assignees=FulcrumOne%2C+jay-jay-lama&labels=state%3A+inactive%2C+type%3A+bug&projects=&template=🦟-bug-report.md&title=%5BBUG%5D).
+If you would like to contribute, please refer to the [Contribution Guidelines](https://link.mijick.com/contribution-guidelines).
-[NavigationView]: https://github.com/Mijick/NavigationView
-[CalendarView]: https://github.com/Mijick/CalendarView
-[CameraView]: https://github.com/Mijick/CameraView
-[GridView]: https://github.com/Mijick/GridView
-[Timer]: https://github.com/Mijick/Timer
+
+# 💜 Sponsor our work
+Support our work by [becoming a backer](https://link.mijick.com/buymeacoffee).