Swift UI Kit to present clean modal/alert

Overview


CleanyModal is a good way to use UI-Customised alerts with ease

Features

  • Present some kind of clean alerts (With same API as UIAlertViewController)
  • Add easily Textfields or Custom views as an Alert contains content UIStackView
  • Action Sheets
  • Present full-custom components as modal from a container view
  • iOS 13 compatible with dark/light mode implemented by default

Demo

Present highly customizable and clean alert from provided built-in methods:

Use root modal system to present your custom components and use only the navigation/interaction stuff:

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Preview

Present a clean Alert with default style:

let alert = MyAlertViewController(
    title: "Hello world",
    message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed massa a magna semper semper a eget justo",
    imageName: "warning_icon")

alert.addAction(title: "OK", style: .default)
alert.addAction(title: "Cancel", style: .cancel)

present(alert, animated: true, completion: nil)

Apply your own style/theme easily :

class MyAlertViewController: CleanyAlertViewController {
    init(title: String?, message: String?, imageName: String? = nil, preferredStyle: CleanyAlertViewController.Style = .alert) {
        let styleSettings = CleanyAlertConfig.getDefaultStyleSettings()
        styleSettings[.tintColor] = .yellow
        styleSettings[.destructiveColor] = .pink
        super.init(title: title, message: message, imageName: imageName, preferredStyle: preferredStyle, styleSettings: styleSettings)
    }
}

Need to push customization of your Alerts further ?

Extend styles settings keys :

public extension CleanyAlertConfig.StyleKeys {
  public static let shadowOffset = CleanyAlertConfig.StyleKey<CGSize>("shadowOffset")
}

Then apply these news keys in viewDidLoad() implementation of your custom alert. If you only want to present a custom component (not an alert) as a modal, inherit directly form CleanyModalViewController

See example project to see all abilities to customize, enjoy !

Requirements

  • iOS 9.0+
  • Swift 4.2+

Installation

CleanyModal is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CleanyModal'

Author

lory huz, [email protected]

License

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

Comments
  • Caught an error while compiling

    Caught an error while compiling

    caught an error while compiling for the following configuration X-Code Version 10.1 (10B61) Swift 4.2

    Error Message Generic parameter 'T' could not be inferred

    if #available(iOS 13.0, *) { styleSettings.set(key: .textColor, value: .label) styleSettings.set(key: .defaultActionColor, value: .label) styleSettings.set(key: .destructiveColor, value: .systemRed) styleSettings.set(key: .tintColor, value: .systemBlue) }

    Can you let me know how can able to fix this following in swift 4.2

    opened by arishanapalli 2
  • Adding UISwitch and UIDatePicker

    Adding UISwitch and UIDatePicker

    Hey, love this framework. I am attempting to add a UISwitch and UIDatePicker to the alert, is this possible?

    I am quite new to swift, and I imagine it's something simple that I have overlooked.

    Thanks, Josh

    bug 
    opened by jaytrisw 2
  • Specify a platform for this target in Example Podfile

    Specify a platform for this target in Example Podfile

    $ pod install
    
    ...
    
    [!] Automatically assigning platform `ios` with version `9.3` on target `CleanyModal_Example` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
    
    opened by ykws 1
  • Adding SPM Support

    Adding SPM Support

    • Adding Package.swift to support SPM.
    • Updating .gitignore to ignore .swiftpm.
    • Fixing module issue in CleanyAlertActionTableViewCell.xib.
    • Adding Bundle+Extension.swift to hold bundle extensions.
    • Added current bundle variable, which returns the current module for either SPM or CocoaPods.
    • Updating README.md
    opened by afnanm1999 0
  • Can't displayed attributed text in the default initializer

    Can't displayed attributed text in the default initializer

    How would one implement the message label on the main alert to be attributed text? I tried changing the default init to be of ‘NSAttributedString’, but I didn’t know how to change it in the file AlertModel, because when I changed message to be of type NSAttributedString, I got an error that I couldn’t fix.

    enhancement 
    opened by jderbs 3
Owner
Lory Huz
Product designer. Love crafting nice UX/UI in Swift
Lory Huz
An easier constructor for UIAlertController. Present an alert from anywhere.

ALRT An easier constructor for UIAlertController. Present an alert from anywhere like this. ALRT.create(.alert, title: "Alert?").addOK().addCancel().s

Masahiro Watanabe 97 Nov 11, 2022
BottomSheetDemo - Bottom sheet modal view controller with swift

当我们想弹出一个预览视图,bottom sheet modal view controller 非常实用。在 iOS 中,长按拖拽手势可以让 controlle

null 8 Oct 29, 2022
Present a sheet ViewController easily and control ViewController height with pangesture

PanControllerHeight is designed to present a sheet ViewController easily and control ViewController height with pangesture.

null 2 May 3, 2022
LBBottomSheet gives you the ability to present a controller in a kind of

LBBottomSheet Installation Swift Package Manager To install using Swift Package Manager, in Xcode, go to File > Add Packages..., and use this URL to f

Lunabee Studio 48 Dec 9, 2022
Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift

CDAlertView is highly customizable alert popup written in Swift. Usage is similar to UIAlertController. Screenshots Animations Usage Basic usage witho

Candost Dagdeviren 1.1k Dec 30, 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
Beautiful animated Alert View. Written in Swift

SCLAlertView Animated Alert View written in Swift, which can be used as a UIAlertView or UIAlertController replacement. Since UIAlertView is deprecate

Viktor Radchenko 5.2k Jan 3, 2023
Live animated Alert View for iOS written in Swift

Sweet Alert iOS Beautiful Animated custom Alert View inspired from javascript library SweetAlert. Written in Swift this SweetAlertView can be used in

Sahil 2k Dec 22, 2022
A Swift package for iOS/tvOS for easy alert presentation

AlertPresenter Listed on the Swift Package Index and originally posted on my blog. It can be fiddly to handle the presentation of alerts on a specific

Chris Mash 14 Jul 1, 2022
Simple Alert View written in Swift, which can be used as a UIAlertController. (AlertController/AlertView/ActionSheet)

DOAlertController Simple Alert View written in Swift, which can be used as a UIAlertController replacement. It supports from iOS7! It is simple and ea

Daiki Okumura 406 Sep 5, 2022
Customizable simple Alert and simple ActionSheet for Swift

SimpleAlert It is simple and easily customizable alert. Can be used as UIAlertController. Appetize's Demo Requirements Swift 5.0 iOS 9.0 or later How

Kyohei Ito 397 Dec 6, 2022
A Simple Customizable Alert With Swift

SimpleCustomizableAlert trying to make my very first library. Support Title Message (TextView) Image TextField Button Action Example let alert

null 1 Oct 26, 2021
(Experimental libraries) Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI.

UIPresentCoordinator Controls interrupt handling, such as alert views, and is compatible with UIKit and Swift UI. This library manages items that are

Yuki Tamazawa 1 Jan 22, 2022
A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

A simple custom popup dialog view for iOS written in Swift. Replaces UIAlertController alert style.

donggyu 5 Jan 26, 2022
A colored alert view for your iOS.

日本語 KRAlertController KRAlertController is a beautiful and easy-to-use alert controller for your iOS written by Swift. Requirements iOS 10.0+ Xcode 10

K.R.Impedance 52 Jun 30, 2022
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

Paolo Musolino 2.5k Jan 3, 2023
Native alert from Apple Music & Feedback. Contains Done, Heart & Message and other presets.

SPAlert Popup from Apple Music & Feedback in AppStore. Contains Done, Heart, Error and other presets. Supports Dark Mode. I tried to recreate Apple's

Ivan Vorobei 1.8k Jan 7, 2023
Zingle – An alert will display underneath your UINavigationBar 🎅

Zingle Zingle – An alert will display underneath your UINavigationBar ?? ?? Note: Zingle has a dependency to have a UINavigationController in your app

Hemang 109 Jun 24, 2022
PMAlertController is a great and customizable alert that can substitute UIAlertController

PMAlertController is a small library that allows you to substitute Apple's uncustomizable UIAlertController, with a beautiful and totally customizable

Paolo Musolino 2.5k Jan 3, 2023