{"id":15026563,"url":"https://github.com/codigami/cfalertviewcontroller","last_synced_at":"2025-05-16T06:06:31.194Z","repository":{"id":9304796,"uuid":"61525786","full_name":"Codigami/CFAlertViewController","owner":"Codigami","description":"It is a highly configurable iOS library which allows easy styling with built in styles as well as extra header and footer views so that you can make extremely unique alerts and action sheets.","archived":false,"fork":false,"pushed_at":"2022-05-14T22:08:06.000Z","size":32904,"stargazers_count":1060,"open_issues_count":10,"forks_count":60,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-05-16T06:06:23.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","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/Codigami.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-20T07:31:24.000Z","updated_at":"2025-04-28T06:31:09.000Z","dependencies_parsed_at":"2022-11-28T10:34:15.091Z","dependency_job_id":null,"html_url":"https://github.com/Codigami/CFAlertViewController","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codigami%2FCFAlertViewController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codigami%2FCFAlertViewController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codigami%2FCFAlertViewController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Codigami%2FCFAlertViewController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Codigami","download_url":"https://codeload.github.com/Codigami/CFAlertViewController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478190,"owners_count":22077676,"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":[],"created_at":"2024-09-24T20:04:42.109Z","updated_at":"2025-05-16T06:06:26.183Z","avatar_url":"https://github.com/Codigami.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  CFAlertViewController\n[![CocoaPods](https://img.shields.io/cocoapods/v/CFAlertViewController.svg)](https://cocoapods.org/pods/CFAlertViewController)\n[![CocoaPods](https://img.shields.io/cocoapods/dt/CFAlertViewController.svg)](https://cocoapods.org/pods/CFAlertViewController)\n[![license](https://img.shields.io/github/license/codigami/cfalertviewcontroller.svg)](https://github.com/Codigami/CFAlertViewController/blob/master/README.md)\n[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/home?status=CFAlertViewController%20-%20Now%20display%20and%20customise%20alerts%20and%20action%20sheets%20on%20iOS%20like%20never%20before!%20%23OpenSource%20https%3A//github.com/Codigami/CFAlertViewController)\n\n`CFAlertViewController` is a library that helps you display and customise **Alerts, Action Sheets, and Notifications** on iPad and iPhone. It offers screen rotation as well as an adaptive UI support. CFAlertViewController’s API is almost similar to the native UIAlertController but it has a lot more functionalities than the native UIAlertController.\n\nYou can also check out this library for ![Android](/Images/android_small.png) **Android** by clicking [here](https://github.com/Codigami/CFAlertDialog)\n\n#### Types of use cases:\n\n![Demo 1](/Images/Demo_1.gif)\n\n#### Configuration options:\n\n![Demo 2](/Images/Demo_2.gif)\n\n## Requirements :\n\nCFAlertViewController works on devices (iPhone and iPad) with iOS 8.0+. It depends on the following Apple frameworks: \n\n* Foundation.framework\n* UIKit.framework\n\n#### Install using Cocoapods (recommended)\nWe assume that your Cocoapods is already configured. If you are new to Cocoapods, have a look at the [documentation](https://cocoapods.org/)\n\n1. Add `pod 'CFAlertViewController'` to your Podfile.\n2. Install the pod(s) by running `pod install` in terminal (in folder where `Podfile` file is located).\n\n#### Install using Source file  \nOpen the downloaded project in Xcode, then drag and drop folder named **CFAlertViewController** onto your project (use the \"Product Navigator view\"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.\n\n## Usage :  \n\u003cp\u003e\n    \u003cimg src=\"/Images/Use%20Cases.png\" style=\"width: 100%\" /\u003e\n\u003c/p\u003e\n\nThe above shown alert can easily be implemented using the code snippet:\n```swift\n// Create Alet View Controller\nlet alertController = CFAlertViewController(title: \"You've hit the limit\",\n                                            message: \"Looks like you've hit your daily follow/unfollow limit. Upgrade to our paid plan to be able to remove your limits.\",\n                                            textAlignment: .left,\n                                            preferredStyle: .notification,\n                                            didDismissAlertHandler: nil)\n\n// Create Upgrade Action\nlet defaultAction = CFAlertAction(title: \"UPGRADE\",\n                                  style: .Default,\n                                  alignment: .right,\n                                  backgroundColor: UIColor(red: CGFloat(46.0 / 255.0), green: CGFloat(204.0 / 255.0), blue: CGFloat(113.0 / 255.0), alpha: CGFloat(1)),\n                                  textColor: nil,\n                                  handler: { (action) in\n                                    print(\"Button with title '\" + action.title! + \"' tapped\")\n})\n\n// Add Action Button Into Alert\nalertController.addAction(defaultAction)\n\n// Present Alert View Controller\npresent(alertController, animated: true, completion: nil)\n```\n\n## Customisations :\n\n### Alerts\n\n```swift\npublic convenience init(title: String?,\n                        titleColor: UIColor?,\n                        message: String?,\n                        messageColor: UIColor?,\n                        textAlignment: NSTextAlignment,\n                        preferredStyle: CFAlertControllerStyle,\n                        headerView: UIView?,\n                        footerView: UIView?,\n                        didDismissAlertHandler dismiss: CFAlertViewControllerDismissBlock?)\n```\n\n##### Title and Message\nYou can set a custom title and message text in the alert (pass `nil` if you don’t need them).\n\n##### Title Color and Message Color\nYou can set a custom title and message text color in the alert (pass `nil` if you want to use Default color values).\n\n##### Alignment\nYou can customise alignment of the title and message. Set the `textAlignment` property with one of the following values : \n\n```swift\nNSTextAlignment.left,    \nNSTextAlignment.right,    \nNSTextAlignment.center,\nNSTextAlignment.justified,\nNSTextAlignment.natural\n```\n\n##### Alert Style  \nPresentation style of the alert can be customised as Alert or Action sheet. Just set the `preferredStyle` property with one of the following values :\n```swift\nCFAlertControllerStyle.alert,\nCFAlertControllerStyle.actionSheet,\nCFAlertControllerStyle.notification\n```\n\n##### Background style\nBackground (overlay) of alert/action sheet can be blurred (Useful for security reasons in case the background needs to be hidden). Default value is `plain`. You can customize the blur style using `backgroundBlurView` property of type UIVisualEffectView. Update `backgroundStyle` property with one of the following enum values:\n\n```swift\nCFAlertControllerBackgroundStyle.plain,\nCFAlertControllerBackgroundStyle.blur\n```\n\n##### Background color\nYou can change the background (overlay) color of the alert/actionsheet using the property `backgroundColor`.\n\n##### Dismiss on background tap\nBy default, the alert gets dismissed after tapping on the background (overlay). Change `shouldDismissOnBackgroundTap` property to `false` to disable it. Do remember that whenever `shouldDismissOnBackgroundTap` property is set to `true`, the user will be able to dismiss `ActionSheet` or `Notification` using interactive swipe gesture.\n\n##### Header / Footer\n You can add header and footer to the alert. Set properties `headerView` and `footerView` with custom views (subclass of UIView). You can pass nil to this properties to opt them out.  \n \n 1) Some examples where you can make the use of header in alert (the dollar image is in header)\n\u003cp\u003e\n    \u003cimg src=\"/Images/Alert%20With%20Header.png\" style=\"width: 100%\" /\u003e\n\u003c/p\u003e\n\n2) Some examples where you can make the use of footer in alert\n\u003cp\u003e\n    \u003cimg src=\"/Images/Alert%20With%20Footer.png\" style=\"width: 100%\" /\u003e\n\u003c/p\u003e\n\n##### Callback\nA block (of type CFAlertViewControllerDismissBlock) gets called when the Alert / Action Sheet is dismissed. You can use it to handle dismiss call back. It also gives you a reason of dismiss with below mentioned enums,\n```swift\nCFAlertControllerDismissReason.none,\nCFAlertControllerDismissReason.onActionTap\nCFAlertControllerDismissReason.onBackgroundTap\nCFAlertControllerDismissReason.onInteractiveTransition\n```\n\n### Actions\n```swift\npublic convenience init(title: String?,\n                        style: CFAlertActionStyle,\n                        alignment: CFAlertActionAlignment,\n                        backgroundColor: UIColor?,\n                        textColor: UIColor?,\n                        handler: CFAlertActionHandlerBlock?)\n```                           \n##### Title\nYou can set the title of action button to be added.  \n\n##### Action Style\nConfigure the style of the action button that is to be added to alert view. Set `style` property of the above method with one of the following Action style  \n```swift\n CFAlertActionStyle.Default,\n CFAlertActionStyle.Cancel,\n CFAlertActionStyle.Destructive\n```\n\n##### Actions Alignment\nConfigure the alignment of the action button added to the alert view. Set `alignment` property of  CFAction constructor with one of the following action types\n```swift\n CFAlertActionAlignment.justified,   // Action Button occupies the full width\n CFAlertActionAlignment.right,\n CFAlertActionAlignment.left,\n CFAlertActionAlignment.center\n```\n\n##### Callback\nA block (of type CFAlertActionHandlerBlock) gets invoked when action is tapped. \n\n### Container View\nYou can also configure the background color or layer related properties (e.g. cornerRadius, borderColor, borderWidth) in the `containerView` property.\n\n## License\nThis code is distributed under the terms and conditions of the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodigami%2Fcfalertviewcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodigami%2Fcfalertviewcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodigami%2Fcfalertviewcontroller/lists"}