{"id":21318363,"url":"https://github.com/mezhevikin/alertcontroller","last_synced_at":"2025-07-12T02:33:21.331Z","repository":{"id":63917858,"uuid":"535272609","full_name":"mezhevikin/AlertController","owner":"mezhevikin","description":"💬 A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code.","archived":false,"fork":false,"pushed_at":"2023-06-24T09:19:08.000Z","size":15,"stargazers_count":18,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T17:17:04.574Z","etag":null,"topics":["actionsheet","alert","alertview","cocoapods","extension","ios","lightweight","modal","notification","popover","popup","spm","swift","swift-package-manager","syntactic-sugar","uialertcontroller","uikit","wrapper"],"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/mezhevikin.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}},"created_at":"2022-09-11T11:10:48.000Z","updated_at":"2024-08-28T00:18:26.000Z","dependencies_parsed_at":"2023-01-14T13:45:28.081Z","dependency_job_id":null,"html_url":"https://github.com/mezhevikin/AlertController","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/mezhevikin%2FAlertController","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2FAlertController/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2FAlertController/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mezhevikin%2FAlertController/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mezhevikin","download_url":"https://codeload.github.com/mezhevikin/AlertController/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225787454,"owners_count":17524108,"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":["actionsheet","alert","alertview","cocoapods","extension","ios","lightweight","modal","notification","popover","popup","spm","swift","swift-package-manager","syntactic-sugar","uialertcontroller","uikit","wrapper"],"created_at":"2024-11-21T19:12:31.698Z","updated_at":"2024-11-21T19:12:32.313Z","avatar_url":"https://github.com/mezhevikin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlertController\n\n💬 A tiny extension for UIAlertController that makes working with it very simple. Only 150 lines of code.\n\n### Alert\n\n```swift\nlet alert = UIAlertController.alert()\nalert.setTitle(\"✅ Success\", color: .darkGreen)\nalert.setMessage(\"Your message has been sent\")\nalert.addAction(\n    title: \"Send more\",\n    systemIcon: \"envelope.fill\",\n    color: .darkGreen,\n    leftAligment: true\n) {}\nalert.addAction(\n    title: \"Delete message\",\n    systemIcon: \"trash.fill\",\n    color: .red,\n    leftAligment: true\n) {}\nalert.addOkAction()\npresent(alert, animated: true)\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/mezhevikin/AlertControllerExample/blob/master/Screens/alert.jpg?raw=true\" width=\"250\"\u003e\n\u003c/p\u003e\n\n### Sheet\n\n```swift\nlet sheet = UIAlertController.sheet(\"👨🏻 Mezhevikin Alexey\")\nsheet.addAction(\n    title: \"Edit profile\",\n    systemIcon: \"person.fill\",\n    color: .darkGreen,\n    leftAligment: true\n) {}\nsheet.addAction(\n    title: \"Delete account\",\n    systemIcon: \"trash.fill\",\n    color: .red,\n    leftAligment: true\n) {}\nsheet.addAction(\n    title: \"Log out\",\n    systemIcon: \"square.and.arrow.down.fill\",\n    leftAligment: true\n) {}\nsheet.addCancelAction()\npresent(sheet, sourceView: cell)\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/mezhevikin/AlertControllerExample/blob/master/Screens/sheet.jpg?raw=true\" width=\"250\"\u003e\n\u003c/p\u003e\n\n### Choice\n\n```swift\nlet sheet = UIAlertController.sheet(\"Choose your favorite animal\")\nlet animals = [\"🐈 Cat\", \"🐕 Dog\", \"🐎 Horse\", \"🐫 Camel\"]\nfor (i, animal) in animals.enumerated() {\n    sheet.addAction(\n        title: animal,\n        checked: favoriteAnimal == i,\n        leftAligment: true\n    ) {\n        self.favoriteAnimal = i\n    }\n }\nsheet.addCancelAction()\npresent(sheet, sourceView: cell)\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/mezhevikin/AlertControllerExample/blob/master/Screens/choice.jpg?raw=true\" width=\"250\"\u003e\n\u003c/p\u003e\n\n### TextField\n\n```swift\nlet alert = UIAlertController.alert(\"🔓 Login\")\nalert.addTextField {\n    $0.placeholder = \"✉️ Mail\"\n}\nalert.addTextField {\n    $0.placeholder = \"🔑 Password\"\n    $0.isSecureTextEntry = true\n}\nalert.addAction(title: \"OK\") {\n    if let mail = alert.textFields?[0].text,\n       let password = alert.textFields?[1].text\n    {\n        print(\"✉️ \\(mail), 🔑 \\(password)\")    \n    }\n}\npresent(alert)\n```\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/mezhevikin/AlertControllerExample/blob/master/Screens/fields.jpg?raw=true\" width=\"250\"\u003e\n\u003c/p\u003e\n\n### Present\n\n```swift\n// Alert\npresent(alert)\n// Sheet from cell with iPad support\npresent(sheet, sourceView: cell) \n// Sheet from BarButton with iPad support\npresent(sheet, barButtonItem: navigationItem.leftBarButtonItem) \n```\n\n### Swift Package Manager\n\n```\nhttps://github.com/mezhevikin/AlertController.git\n```\n\n### CocoaPods\n\n```\npod 'AlertController', :git =\u003e 'https://github.com/mezhevikin/AlertController.git'\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmezhevikin%2Falertcontroller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmezhevikin%2Falertcontroller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmezhevikin%2Falertcontroller/lists"}