Create fully customizable popups easier than ever before ⚜️

Related tags

Popup FlexFlex
Overview

FlexFlex

Create fully customizable popups easier than ever before.

🛠 Installation

FlexFlex requires iOS 13 and Xcode 12.

1️⃣ In Xcode go to FileAdd Packages...

2️⃣ In the top right corner, paste https://github.com/adri567/FlexFlex.git and press Enter.

3️⃣ Choose FlexFlex from the list ➤ Add Package

This was easy, or? Now you can use FlexFlex in your project!

❤️‍🔥 Example

🪛 Usage

Copy this code ⬇️

import FlexFlex

Create a property to toggle the State to show the popup

@State private var isPresenting: Bool = false

FlexPopup({
    // Any content
}, presenting: $isPresenting, position: .top, closeOnTap: true)

〽️ Example code from above

struct ContentView: View {
    @State private var isPresentingTop: Bool = false
    @State private var isPresentingCenter: Bool = false
    @State private var isPresentingBottom: Bool = false
    
    var body: some View {
        ZStack {
            Color.white
                .ignoresSafeArea()
            VStack(spacing: 40) {
                Button {
                    withAnimation {
                        isPresentingTop.toggle()
                        automaticDismiss()
                    }
                } label: {
                    Text("Top")
                }
                Button {
                    withAnimation {
                        isPresentingCenter.toggle()
                    }
                } label: {
                    Text("Center")
                }
                Button {
                    withAnimation {
                        isPresentingBottom.toggle()
                    }
                } label: {
                    Text("Bottom")
                }
            }
            FlexPopup({
                top
            }, presenting: $isPresentingTop, position: .top, closeOnTap: true)
            FlexPopup({
                center
            }, presenting: $isPresentingCenter, position: .center, closeOnTap: true)
            FlexPopup({
                bottom
            }, presenting: $isPresentingBottom, position: .bottom, closeOnTap: true)
        }
    }
    
    private var bottom: some View {
        VStack {
            Text("Are you sure you want to cancel the contract?")
                .font(.title3)
                .foregroundColor(.black)
                .fixedSize(horizontal: false, vertical: true)
                .multilineTextAlignment(.center)
            Button {
                isPresentingBottom.toggle()
            } label: {
                Text("Cancel contract")
                    .font(.title3)
                    .fontWeight(.bold)
                    .foregroundColor(.white)
                    .frame(height: 48)
                    .frame(maxWidth: .infinity)
                    .background(Color.red)
                    .cornerRadius(10)
                    .padding()
            }
        }
    }
    
    private var center: some View {
        VStack(spacing: 0) {
            Image(systemName: "tropicalstorm")
                .resizable()
                .frame(maxWidth: 100)
                .frame(height: 150)
                .aspectRatio(contentMode: .fill)
                .foregroundColor(.yellow)
            Text("Congratulations!")
                .font(.title)
                .fontWeight(.bold)
                .padding(.vertical)
                .foregroundColor(.black)
            Text("You found the hidden spiral that gives you infinite power.")
                .font(.title3)
                .foregroundColor(.black)
                .fixedSize(horizontal: false, vertical: true)
                .padding(.horizontal)
                .multilineTextAlignment(.center)
            Button {
                isPresentingCenter.toggle()
            } label: {
                Text("Collect")
                    .font(.title3)
                    .fontWeight(.bold)
                    .foregroundColor(.white)
                    .frame(height: 48)
                    .frame(maxWidth: .infinity)
                    .background(Color.green)
                    .cornerRadius(10)
                    .padding()
            }
        }
    }
    
    private var top: some View {
        VStack {
            HStack {
                Image(systemName: "battery.100")
                    .foregroundColor(.green)
                Text("Youre battery is full of charge.")
                    .foregroundColor(.black)
            }
        }
    }
    
    func automaticDismiss() {
        DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
            isPresentingTop.toggle()
        }
    }
    
}  
You might also like...
SwiftOverlays is a Swift GUI library for displaying various popups and notifications
SwiftOverlays is a Swift GUI library for displaying various popups and notifications

SwiftOverlays is a Swift GUI library for displaying various popups and notifications. SwiftOverlays animated logo is kindly made by Crafted Pixels Fea

An example of creating custom popups in SwiftUI
An example of creating custom popups in SwiftUI

Custom Popup Example An example project for Implementing custom popups in SwiftUI article. Author Artem Novichkov, [email protected] License The

Toasts and popups library written with SwiftUI
Toasts and popups library written with SwiftUI

Popup View Toasts and popups library written with SwiftUI We are a development agency building phenomenal apps. Usage Put all your body code into a ZS

LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.
LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.

LNPopupController LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and

 GUI library for displaying various popups (HUD), written in pure Swift.
GUI library for displaying various popups (HUD), written in pure Swift.

SwiftNotice SwiftNotice is a GUI library for displaying various popups (HUD) written in pure Swift, fits any scrollview and supports iPhone X. Feature

Hue is the all-in-one coloring utility that you'll ever need.
Hue is the all-in-one coloring utility that you'll ever need.

Hue is the all-in-one coloring utility that you'll ever need. Usage Hex You can easily use hex colors with the init(hex:) convenience initializer on U

A handy collection of more than 500 native Swift extensions to boost your productivity.

SwifterSwift is a collection of over 500 native Swift extensions, with handy methods, syntactic sugar, and performance improvements for wide range of

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.

URLImage URLImage is a SwiftUI view that displays an image downloaded from provided URL. URLImage manages downloading remote image and caching it loca

A package to help track how often the user opened the app and if they opened it in the current version before.

AppOpenTracker AppOpenTracker provides an observable AppOpenTracker.shared instance that can be used to track the last version that the app was opened

A handy collection of more than 500 native Swift extensions to boost your productivity.

SwifterSwift is a collection of over 500 native Swift extensions, with handy methods, syntactic sugar, and performance improvements for wide range of

URLScheme router than supports auto creation of UIViewControllers for associated url parameters to allow creation of navigation stacks

IKRouter What does it do? Once you have made your UIViewControllers conform to Routable you can register them with the parameters that they represent

The most perfect Swift Timer you'll ever need.

Timerable ⏰ The most perfect Swift Timer you'll ever need. A protocol-oriented Timer Factory with all the features you'll ever need. I wrote it in bot

Cluster's reusable pre-permissions utility that lets developers ask the users on their own dialog for photos or contacts access, before making the system-based request.
Cluster's reusable pre-permissions utility that lets developers ask the users on their own dialog for photos or contacts access, before making the system-based request.

Cluster's reusable pre-permissions utility that lets developers ask the users on their own dialog for photos or contacts access, before making the system-based request. This is based on the Medium post by Cluster describing the different ways to ask for iOS permissions (https://medium.com/p/96fa4eb54f2c).

Rock - Paper - Scissors game. CPU gives you a sign and asks to win or lose your move. Than you have to decide witch sign do you choose to score a point
Rock - Paper - Scissors game. CPU gives you a sign and asks to win or lose your move. Than you have to decide witch sign do you choose to score a point

RockPaperScissors 2nd challange from HackingWithSwift.com. The CPU gives you a sign (rock, paper or scissors) and asks you either to win or to lose th

iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion. You can use this app for learning purpose. You can use this app as a templet of any event related app.
iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion. You can use this app for learning purpose. You can use this app as a templet of any event related app.

technex-ios iOS app for Technex, IIT(BHU) Varanasi. This project is closed before completion for some reasons. You can use this app for learning purpo

Check your emails before someone else does

Checkpoint Proofread your emails before your mom does 🧠 Have you ever meant to

May be the most elegant stepper you have ever had!

PFStepper It may be the most elegant stepper you have ever had! Usage To be written. Todo Documenting @IBDesignable supporting Animations Customizable

Have you ever wanted to just throw your optional like a table?

JebStolem Have you ever wanted to just throw your optional like a table? Or mayb

Conv smart represent UICollectionView data structure more than UIKit.
Conv smart represent UICollectionView data structure more than UIKit.

Conv Conv smart represent UICollectionView data structure more than UIKit. Easy definition for UICollectionView DataSource and Delegate methods. And C

Releases(1.0.2)
Owner
adri567
I like to program in Swift and Python 🙃 Check out my apps 📲 Vimoapp and Sneakz.
adri567
Toasts and popups library written with SwiftUI

Popup View Toasts and popups library written with SwiftUI We are a development agency building phenomenal apps. Usage Put all your body code into a ZS

Exyte 1.9k Jan 6, 2023
LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and Podcasts apps.

LNPopupController LNPopupController is a framework for presenting view controllers as popups of other view controllers, much like the Apple Music and

Leo Natan 2.9k Jan 2, 2023
The library allows to create simple popup menus

react-native-popup-menu This library allows to create simple popup menus Installation "react-native-popup-menu": "sergeymild/react-native-popup-menu"

SergeyMild 0 Aug 20, 2022
A simple, customizable popup dialog for iOS written in Swift. Replaces UIAlertController alert style.

Introduction Popup Dialog is a simple, customizable popup dialog written in Swift. Features Easy to use API with hardly any boilerplate code Convenien

Orderella Ltd. 3.8k Dec 20, 2022
A highly customizable alert dialog controller that mimics Snapchat's alert dialog.

AZDialogViewController A highly customizable alert dialog controller that mimics Snapchat's alert dialog. Screenshots Installation CocoaPods: pod 'AZD

Antonio Zaitoun 771 Dec 11, 2022
RxAlamoRecord combines the power of the AlamoRecord and RxSwift libraries to create a networking layer that makes interacting with API's easier than ever reactively.

Written in Swift 5 RxAlamoRecord combines the power of the AlamoRecord and RxSwift libraries to create a networking layer that makes interacting with

Dalton Hinterscher 9 Aug 7, 2020
MIBlurPopup lets you create popups with a blurred background

MIBlurPopup MIBlurPopup lets you create amazing popups with a blurred background Setup Add pod 'MIBlurPopup' to your Podfile or copy the "MIBlurPopup.

Mario Iannotta 607 Nov 24, 2022
PagingKit provides customizable menu UI. It has more flexible layout and design than the other libraries.

PagingKit provides customizable menu & content UI. It has more flexible layout and design than the other libraries. What's this? There are many librar

Kazuhiro Hayashi 1.3k Jan 9, 2023
SwiftUI library to create fully customizable input stepper.

SwiftUI-InputStepper Swift package for creating numerical input stepper. An example of input stepper created with this library It supports long press

Mateusz Budnik 4 Nov 2, 2022
Toasts and popups library written with SwiftUI

Popup View Toasts and popups library written with SwiftUI We are a development agency building phenomenal apps. Usage Put all your body code into a ZS

Exyte 1.9k Jan 5, 2023