{"id":25157584,"url":"https://github.com/podkovyrin/dwalertcontroller","last_synced_at":"2025-05-16T08:07:01.747Z","repository":{"id":46585081,"uuid":"205809704","full_name":"podkovyrin/DWAlertController","owner":"podkovyrin","description":"UIAlertController re-implementation with controller containment support","archived":false,"fork":false,"pushed_at":"2025-01-09T12:44:55.000Z","size":762,"stargazers_count":306,"open_issues_count":1,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-10T17:03:31.991Z","etag":null,"topics":["alert","ios","objective-c","swift","uialertcontroller","uialertcontroller-customization"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/podkovyrin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-02T08:19:56.000Z","updated_at":"2025-02-05T03:43:24.000Z","dependencies_parsed_at":"2025-02-09T01:40:57.011Z","dependency_job_id":"be6cbe18-7018-4564-ab1d-c176d55fc0ce","html_url":"https://github.com/podkovyrin/DWAlertController","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podkovyrin%2FDWAlertController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podkovyrin%2FDWAlertController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podkovyrin%2FDWAlertController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/podkovyrin%2FDWAlertController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/podkovyrin","download_url":"https://codeload.github.com/podkovyrin/DWAlertController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493385,"owners_count":22080127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alert","ios","objective-c","swift","uialertcontroller","uialertcontroller-customization"],"created_at":"2025-02-09T01:40:52.857Z","updated_at":"2025-05-16T08:06:56.740Z","avatar_url":"https://github.com/podkovyrin.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DWAlertController\n\n[![CI Status](https://img.shields.io/travis/podkovyrin/DWAlertController.svg?style=flat)](https://travis-ci.org/podkovyrin/DWAlertController)\n[![Version](https://img.shields.io/cocoapods/v/DWAlertController.svg?style=flat)](https://cocoapods.org/pods/DWAlertController)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Accio supported](https://img.shields.io/badge/Accio-supported-0A7CF5.svg?style=flat)](https://github.com/JamitLabs/Accio)\n[![License](https://img.shields.io/cocoapods/l/DWAlertController.svg?style=flat)](https://cocoapods.org/pods/DWAlertController)\n[![Platform](https://img.shields.io/cocoapods/p/DWAlertController.svg?style=flat)](https://cocoapods.org/pods/DWAlertController)\n\nWhen was the last time you told your designer you couldn't customize UIAlertController? Now it is possible. Without using any private API.\n\nDWAlertController is an UIAlertController that supports displaying any view controller instead of title and message.\nDWAlertController fully copies the look and feel of UIAlertController and has the same API.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/podkovyrin/DWAlertController/raw/master/assets/DWAlertController_Screens.png?raw=true\" alt=\"DWAlertController Screenshots\"\u003e\n\u003c/p\u003e\n\nThis alert successfully used in production in our app [Dash Wallet](https://apps.apple.com/app/dash-wallet/id1206647026).\n\n## Supported Features\n\n- iPhone / iPad compatible\n- Device rotations\n- Keyboard support\n- Customizable action buttons (normal / disabled / destructive tint colors)\n- Tap and slide over the action buttons\n- Custom presentation and dismissal transitions (corresponds to `UIAlertController` ones)\n- Dimming tintColor-ed views behind the alert\n- Simple built-in transition from one content controller to another within a single `DWAlertController` (see Advanced alert in the Example app)\n- Dynamic Type\n- Accessibility\n- Dark Mode and dark appearance for iOS 12 or lower\n\n## Usage\n\nDWAlertController is written in Objective-C and optimized for Swift. All API that `DWAlertController` provides is the same as `UIAlertController`.\n\n### Swift\n```swift\nlet controller = ... // instantiate view controller\n\nlet alert = DWAlertController(contentController: controller)\n\nlet okAction = DWAlertAction(title: NSLocalizedString(\"OK\", comment: \"\"),\n                             style: .cancel,\n                             handler: nil)\nalert.addAction(okAction)\n\npresent(alert, animated: true)\n```\n\n### Objective-C\n```obj-c\nUIViewController *controller = ...; // instantiate view controller\n\nDWAlertController *alert = [DWAlertController alertControllerWithContentController:controller];\n\nDWAlertAction *okAction = [DWAlertAction actionWithTitle:NSLocalizedString(@\"OK\", nil)\n                                                   style:DWAlertActionStyleCancel\n                                                 handler:nil];\n[alert addAction:okAction];\n\n[self presentViewController:alert animated:YES completion:nil];\n```\n\n### Important notice\n\nTo make `DWAlertController` works with a custom content controller, the view of the content controller must correctly implement Autolayout.\nYou might have used the same technique when implementing dynamic-sized `UITableViewCell`'s.\nFor more information see https://stackoverflow.com/a/18746930\n\nSince DWAlertController maintain scrolling of large content controllers internally (as UIAlertController does) there is no need in placing the content of content view controller within UIScrollView.\n\nThe `backgroundColor` of the content controller's view should be transparent (`UIColor.clear`).\n\n## Limitations\n\n- Only `UIAlertController.Style.alert` is supported (since there are a lot of decent implementations of actionSheet-styled controls)\n- Updating the height of the currently displaying view controller is not supported. However, when displaying a new controller with `performTransition(toContentController:animated:)` method, it may have a different height.\n\n## Requirements\n\niOS 9 or later.\n\n## Notes\n\nThe default `UIAlertController` achieves such vibrant and expressive background color by using the private CoreAnimation class `CABackdropLayer` which is lying within another private class `_UIDimmingKnockoutBackdropView` with `UIVisualEffectView`.\nThis layer uses a `CAFilter` with `\"overlayBlendMode\"` to apply the effect to the view behind it. To get more information refer this [answer](https://stackoverflow.com/a/49571448/2830525).\n\nAs we wanted to use this alert in production we couldn't use any of those APIs.\nThere are two possible options to get decent appearance comparable to using the private API.\n\n1. Make a screenshot of a view behind the alert and apply `CIFilter` with `CIOverlayBlendMode` to it. This approach results in the closest appearance to `UIAlertController`. However, there are several reasons why this approach cannot be used. Screenshotting during presentation adds a noticeable lag, neither it can't be done after presentation which might have led to blinking the content behind the alert. It would also have to take a screenshot when the user rotates the screen wich also lead to lags.\n2. Make a \"hole\" in the dimming view behind the alert and allow `UIVisualEffectView` to do all work. As a dimming view, we use `CAShapeLayer` with animatable `path` property to dynamically modify the \"hole\" during rotation or keyboard animation. While this is NOT a 100% smooth solution, it works almost perfectly and looks very close to `UIAlertController`.\n\nAll the colors and layout constants have been carefully copied from the `UIAlertController`.\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Installation via CocoaPods\n\nDWAlertController is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'DWAlertController'\n```\n\n## Installation via Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate DWAlertController into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"podkovyrin/DWAlertController\"\n```\n\n### Installation via Accio\n\n 1. Add the following to your `Package.swift`:\n \t```swift\n \t.package(url: \"https://github.com/podkovyrin/DWAlertController.git\", .upToNextMajor(from: \"0.2.1\")),\n \t```\n 2. Next, add `DWAlertController` to your App targets dependencies like so:\n \t```swift\n \t.target(name: \"App\", dependencies: [\"DWAlertController\"]),\n \t```\n 3. Then run `accio update`.\n\n## Author\n\nAndrew Podkovyrin, podkovyrin@gmail.com\n\n## License\n\nDWAlertController is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodkovyrin%2Fdwalertcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpodkovyrin%2Fdwalertcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpodkovyrin%2Fdwalertcontroller/lists"}