{"id":2449,"url":"https://github.com/Lasithih/LIHAlert","last_synced_at":"2025-08-03T00:30:54.650Z","repository":{"id":50234831,"uuid":"44304068","full_name":"Lasithih/LIHAlert","owner":"Lasithih","description":"Advance animated alerts for iOS written in Swift","archived":true,"fork":false,"pushed_at":"2021-06-01T05:13:54.000Z","size":446,"stargazers_count":38,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-24T14:48:36.965Z","etag":null,"topics":["alert","alertview","ios","ios-animation","ios-swift","ios-ui","swift","swift-3"],"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/Lasithih.png","metadata":{"files":{"readme":"README copy 2.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}},"created_at":"2015-10-15T08:31:50.000Z","updated_at":"2024-04-23T08:01:54.000Z","dependencies_parsed_at":"2022-08-03T06:45:22.730Z","dependency_job_id":null,"html_url":"https://github.com/Lasithih/LIHAlert","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lasithih%2FLIHAlert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lasithih%2FLIHAlert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lasithih%2FLIHAlert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lasithih%2FLIHAlert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lasithih","download_url":"https://codeload.github.com/Lasithih/LIHAlert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228503226,"owners_count":17930543,"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","alertview","ios","ios-animation","ios-swift","ios-ui","swift","swift-3"],"created_at":"2024-01-05T20:16:14.041Z","updated_at":"2024-12-06T17:31:07.962Z","avatar_url":"https://github.com/Lasithih.png","language":"Swift","funding_links":[],"categories":["UI"],"sub_categories":["Alert \u0026 Action Sheet","Other free courses"],"readme":"# LIHAlert\n\n#####LIHAlert provides animated banners for iOS which is written using the apple's newest programming language Swift 2.0. \n\n[![CI Status](http://img.shields.io/travis/Lasith Hettiarachchi/LIHAlert.svg?style=flat)](https://travis-ci.org/Lasith Hettiarachchi/LIHAlert)\n[![Version](https://img.shields.io/cocoapods/v/LIHAlert.svg?style=flat)](http://cocoapods.org/pods/LIHAlert)\n[![License](https://img.shields.io/cocoapods/l/LIHAlert.svg?style=flat)](http://cocoapods.org/pods/LIHAlert)\n[![Platform](https://img.shields.io/cocoapods/p/LIHAlert.svg?style=flat)](http://cocoapods.org/pods/LIHAlert)\n\n### Usage\n\nImport the module using\n```Swift\n    import LIHAlert\n```\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n####1. Predefined Banners\n* Text banner\n* Text with an ActivityIndicator\n* Text with an icon\n* Text with a button\n* Text with two buttons\n* Custom view banner\n\nLIHAlert contains some predefined alerts for each Alert type. You can use following code snippets to use them. \n\n#####1. Text Banner\n\u003cimg src=\"http://3.bp.blogspot.com/-LLVpn6KrnNg/ViiaKmCHIqI/AAAAAAAACsw/13dVIUMG7E0/s300/TextBanner.gif\" /\u003e\n\n```Swift\n    var textAlert: LIHAlert?\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.textAlert = LIHAlertManager.getTextAlert(\"Sample Message\")\n        self.textAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        self.textAlert?.show(nil, hidden: nil)\n    }\n```\nCall showBanner() function to show the banner\n\nTo customize the banner,\n```Swift\n    \tself.textAlert = LIHAlertManager.getTextAlert(\"Sample Message\")\n        self.textAlert?.alertColor = UIColor.yellowColor()\n        textAlert.contentText = message\n        textAlert.alertColor = UIColor(red: 102.0/255.0, green: 197.0/255.0, blue: 241.0/255.0, alpha: 1.0)\n        textAlert.alertHeight = 50.0\n        textAlert.alertAlpha = 1.0\n        textAlert.autoCloseEnabled=true\n        textAlert.contentTextColor = UIColor.whiteColor()\n        textAlert.hasNavigationBar = true\n        textAlert.paddingTop = 0.0\n        textAlert.animationDuration = 0.35\n        textAlert.autoCloseTimeInterval = 1.5\n        self.textAlert?.initAlert(self.view)\n```\n\n#####2. Banner with a text and image\n\u003cimg src=\"http://2.bp.blogspot.com/-pMF5l-2VR0c/ViiaJ8bohOI/AAAAAAAACss/qFciyfThVUg/s300/Success.gif\" /\u003e\n\n```Swift\n    var successAlert: LIHAlert?\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.successAlert = LIHAlertManager.getSuccessAlert(\"Successfully subscribed\")\n        self.successAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        self.successAlert?.show(nil, hidden: nil)\n    }\n```\n\nTo change the icon,\n```Swift\n    successAlert?.icon = UIImage(named:\"imageName\")\n```\n\n\n#####4. Loading Alert\n\nThis is a banner with a text and an activity indicator. This is not an auto close banner. You have to hide it when the process is finished.\n\n\u003cimg src=\"http://3.bp.blogspot.com/-ASkTzpFIuSU/ViiaK2_mSYI/AAAAAAAACs8/6stjXecZWqI/s300/TextWithLoading.gif\" /\u003e\n\n```Swift\n    var processingAlert: LIHAlert?\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.processingAlert = LIHAlertManager.getProcessingAlert(\"Fetching data...\")\n        self.processingAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        self.processingAlert?.show(nil, hidden: nil)\n    }\n    override hideBanner(sender: AnyObject) {\n        self.processingAlert?.hide(nil)\n    }\n```\nCall showBanner() function to show the banner and hideBanner() to hide the banner.\nTo change the activity indicator style,\n```Swift\n    processingAlert?.activityIndicatorStyle = UIActivityIndicatorViewStyle.WhiteLarge\n```\n\n#####5. Text with a button Alert\nThis alert contains a button along with a text. More suitable for notifying important messages to user.\n\u003cimg src=\"http://2.bp.blogspot.com/-lrD_IGv93yE/ViiaKyqoRVI/AAAAAAAACs4/ggqDlP9E-YY/s300/TextWithButton.gif\" /\u003e\n\n```Swift\n    var textWithButtonAlert: LIHAlert?\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.textWithButtonAlert = LIHAlertManager.getTextWithButtonAlert(\"You have successfully subscribed for the monthly newsletter\", buttonText: \"Dismiss\")\n        self.textWithButtonAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        textWithButtonAlert?.show(nil, hidden: nil)\n    }\n```\nCall showBanner() function to show the banner. \nImplement your view controller from LIHAlertDelegate.\n\n```Swift\nclass ViewController: LIHAlertDelegate {\n    func buttonPressed(button: UIButton) {\n        print(“You have pressed the button”)\n        self.textWithButtonAlert?.hideAlert(nil)\n    }\n}\n```\n\n#####6. Text with two buttons Alert\nThis alert contains two buttons along with a text.\n\n\u003cimg src=\"http://3.bp.blogspot.com/-1pXYpVNoNz0/ViiaLcHSqnI/AAAAAAAACtI/NQjV1Pe9ACs/s300/TextWithTwoButtons.gif\" /\u003e\n\n```Swift\n    var textWithTwoButtonsAlert: LIHAlert?\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        self.textWithTwoButtonsAlert = LIHAlertManager.getTextWithTwoButtonsAlert(\"Do you want to subscribe for the monthly newsletter?\", buttonOneText: \"Subscribe\", buttonTwoText: \"Cancel\")\n        self.textWithTwoButtonsAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        textWithTwoButtonsAlert?.show(nil, hidden: nil)\n    }\n```\nCall showBanner() function to show the banner. \nImplement your view controller from LIHAlertDelegate.\n\n```Swift\nclass ViewController: LIHAlertDelegate {\n    func buttonOnePressed(button: UIButton) {\n        self.textWithTwoButtonsAlert?.hideAlert({ () -\u003e () in\n            self.successAlert?.show(nil, hidden: nil)\n        })\n    }\n    func buttonTwoPressed(button: UIButton) {\n        self.textWithTwoButtonsAlert?.hideAlert(nil)\n    }\n}\n```\n\n\n#####7. Custom View Alert\nYou can specify any view to act as the banner.\n\n\u003cimg src=\"http://4.bp.blogspot.com/-lHReuTyaJ8A/ViiaJyAiEfI/AAAAAAAACso/Q9A-X3MNcTo/s300/CustomView.gif\" /\u003e\n\n```Swift\n    var customViewAlert: LIHAlert?\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n\t//In this case I am using an ImageView as the banner\n        let customView = UIImageView(frame: CGRectMake(0.0, 64.0, 100, 50))\n        customView.image = UIImage(named: \"customViewImage\")\n        self.customViewAlert = LIHAlertManager.getCustomViewAlert(customView)\n        self.customViewAlert?.initAlert(self.view)\n    }\n    func showBanner(sender: AnyObject) {\n        self.customViewAlert?.show(nil, hidden: nil)\n    }\n```\n\n####2. Create a banner\n\n```Swift\n\tlet alertTextAlert: LIHAlert = LIHAlert()\n        alertTextAlert.alertType = LIHAlertType.Text\n        alertTextAlert.contentText = message\n        alertTextAlert.alertColor = UIColor(red: 102.0/255.0, green: 197.0/255.0, blue: 241.0/255.0, alpha: 1.0)\n        alertTextAlert.alertHeight = 50.0\n        alertTextAlert.alertAlpha = 1.0\n        alertTextAlert.autoCloseEnabled=true\n        alertTextAlert.contentTextColor = UIColor.whiteColor()\n        alertTextAlert.hasNavigationBar = true\n        alertTextAlert.paddingTop = 0.0\n        alertTextAlert.animationDuration = 0.35\n        alertTextAlert.autoCloseTimeInterval = 1.5\n```\n\n#####LIHALertType\n```Swift\n\tenum LIHAlertType {\n    \t\tcase Custom, Text, TextWithLoading, TextWithIcon, TextWithButton, TextWithTwoButtons\n\t}\n```\n\n### Use the completion callbacks\n```Swift\n\t//when showing an auto hiding banner\n\tlihAlert?.show({ () -\u003e () in\n            \t//alert showed\n            }, hidden: { () -\u003e () in\n                //alert hidden\n        })\n        \n        //when hiding a banner\n        lihAlert?.hideAlert({ () -\u003e () in\n            //Banner hidden\n        })\n```\n\n### Known Issues\n##### 1. Top margin\nIn some projects the alert may appear with a margin on top. Hopefully this will be fixed in the next release. Until then use the following solution.\n###### Solution\nEven the navigation bar is there, set it to false.\n```Swift\nalert.hasNavigationBar = false\n```\n\n\n###Demo Project\nThe LIHAlert workspace contains a demo project, also used for development.\n\n\n### Requirements\nXcode 7+\n\n### Installation\n\nLIHAlert is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod \"LIHAlert\"\n```\n\nor\n\nCopy the LIHAlert folder into your project.\n\n### Author\n\nLasith Hettiarachchi, lasithih@yahoo.com\n\n### License\n\nLIHAlert 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%2FLasithih%2FLIHAlert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLasithih%2FLIHAlert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLasithih%2FLIHAlert/lists"}