29

GitHub - loryhuz/CleanyModal: Swift UI Kit to present clean modal/alert

 5 years ago
source link: https://github.com/loryhuz/CleanyModal
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

51546931-839ac800-1e65-11e9-89a0-aa0d79e25e61.png


68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f762f436c65616e794d6f64616c2e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f6c2f436c65616e794d6f64616c2e7376673f7374796c653d666c6174 68747470733a2f2f696d672e736869656c64732e696f2f636f636f61706f64732f702f436c65616e794d6f64616c2e7376673f7374796c653d666c6174

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
  • Dismiss modal/alert from interaction gesture
  • Present full-custom components as modal from a container view

Demo

51548417-91058180-1e68-11e9-955b-2a7238a09afb.gif

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

44787753-4c670a00-ab98-11e8-869e-a219c82633c0.jpeg

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

38334728-783ae638-385c-11e8-82bf-b6fa65e528ce.jpeg

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 alertConfig = CleanyAlertConfig(
  title: "Hello world",
  message: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas sed massa a magna semper semper a eget justo")
let alert = MyAlertViewController(config: alertConfig)

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

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

Apply your own style/theme easily :

class MyAlertViewController: CleanyAlertViewController {
  override init(config: CleanyAlertConfig) {
    config.styleSettings[.tintColor] = .yellow
    config.styleSettings[.destructiveColor] = .pink
    super.init(config: config)
  }
}

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+

Installation

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

pod 'CleanyModal', '~> 0.1.1'

Author

lory huz, [email protected]

License

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK