{"id":18374259,"url":"https://github.com/mnkgitbox/mnkalertview","last_synced_at":"2025-04-11T02:44:19.922Z","repository":{"id":56920736,"uuid":"448806444","full_name":"MnkGitBox/MNkAlertView","owner":"MnkGitBox","description":"You can create a custom alert view precisely of the design handoff, you can get help from the MNKAlertView framework.","archived":false,"fork":false,"pushed_at":"2022-01-23T10:06:53.000Z","size":653,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T12:32:01.721Z","etag":null,"topics":["alert","alertview","alertview-alertviewcontroller","alertviewcontroller","customalertdialog","customalertmanager","customalerts","customalerts-extension","customalertview","programatically","swift"],"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/MnkGitBox.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-01-17T08:13:44.000Z","updated_at":"2022-01-17T08:26:21.000Z","dependencies_parsed_at":"2022-08-20T21:50:31.338Z","dependency_job_id":null,"html_url":"https://github.com/MnkGitBox/MNkAlertView","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FMNkAlertView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FMNkAlertView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FMNkAlertView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MnkGitBox%2FMNkAlertView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MnkGitBox","download_url":"https://codeload.github.com/MnkGitBox/MNkAlertView/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248331640,"owners_count":21085943,"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","alertview-alertviewcontroller","alertviewcontroller","customalertdialog","customalertmanager","customalerts","customalerts-extension","customalertview","programatically","swift"],"created_at":"2024-11-06T00:13:57.720Z","updated_at":"2025-04-11T02:44:19.901Z","avatar_url":"https://github.com/MnkGitBox.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](MNkAlertView_Banner.png)\n[![Version](https://img.shields.io/cocoapods/v/MNkAlertView.svg?style=flat)](https://cocoapods.org/pods/MNkAlertView)\n[![License](https://img.shields.io/cocoapods/l/MNkAlertView.svg?style=flat)](https://cocoapods.org/pods/MNkAlertView)\n[![Platform](https://img.shields.io/cocoapods/p/MNkAlertView.svg?style=flat)](https://cocoapods.org/pods/MNkAlertView)\n![SPM](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-orange)\n\nIf you want to create a custom alert view precisely of the design handoff, you can get help from the MNKAlertView framework.\n\u003cbr\u003e\n\n## Installation\n\n### CocoaPods\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:\n\n```ruby\n$ gem install cocoapods\n```\nTo integrate MNkAlertView into your Xcode project using CocoaPods, specify it in your Podfile:\n\n```ruby\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '12.0'\nuse_frameworks!\n\ntarget '\u003cYour Target Name\u003e' do\n    pod 'MNkAlertView', '~\u003e 1.0.0'\nend\n```\nThen, run the following command:\n```ruby\n$ pod install\n```\n\n### Swift Package Manager\n\n[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\n\u003e Xcode 11+ is required to build MNkAlertView using Swift Package Manager.\n\n```Swift\ndependencies: [\n    .package(url: \"https://github.com/MnkGitBox/MNkAlertView.git\", .upToNextMajor(from: \"1.0.0\"))\n]\n```\n\n### Manually\n\nIf you prefer not to use either of the aforementioned dependency managers, you can integrate MNkAlertView into your project manually.\n\n---\n\n## Usage\n### **Show Simple Alert**\n\n![simple alert](simple_alert.gif)\n\nYou can build this simple alert view comes with the library by runnig below code.\n\n```Swift \nfunc showAlert() {\n        let alertView = MNkAlertView()\n        alertView.titleLabel.text = \"Confirm\"\n        alertView.messageLabel.text = \"Do you want to proceed with these settings?\"\n        alertView.type = .multi\n        \n        let alertController = MNkAlertViewController()\n        alertController.set(alertView: alertView)\n        self.showAlert(of: alertController, aditional: nil)\n}\n```\n\n### **Build More Customized Alert**\nIf your UI design element doesn't match with the UI element that comes with the library, you can create any custom alert view by subclassing the `MNkAlertView` class. \n\n![custom alert](custom_alert.gif)\n\n- Create `CustomAlertView` view by subclassing the `MNkAlertView`.\n\n```Swift\nclass CustomAlertView: MNkAlertView {\n    private var topStripView: UIView \n    private var indicatorImageView: UIImageView \n    \n    override func createViews() {\n        super.createViews()\n        \n        mainStackView.insertArrangedSubview(indicatorImageView, at: 0)\n        mainStackView.spacing = 20\n        \n        rightActionButton.layer.cornerRadius = 3\n        rightActionButton.backgroundColor = .lightBlue\n        rightActionButton.setTitleColor(.white, for: .normal)\n    }\n    \n    override func insertAndLayoutSubviews() {\n        self.addSubview(alertContainer)\n        alertContainer.addSubview(mainStackView)\n\n        ......\n    }\n    \n    override func config() {\n        backgroundColor = .clear\n    }\n}\n```\n- And call `showAlert(of:_, aditional: _)` function with the `CustomAlertView`.\n\n```Swift \nfunc showCustomAlert() {\n    let alertView = CustomAlertView()\n    alertView.titleLabel.text = \"Saved\"\n    alertView.messageLabel.text = \"New settings save successfully.\"\n        \n    let alertController = MNkAlertViewController()\n    alertController.set(alertView: alertView)\n    self.showAlert(of: alertController, aditional: nil)\n}\n```\n\n- You can catch button action by assign clouser type to `action` variable.\n\n```Swift \nalertView.action = { actionType, data in\n            switch actionType {\n            case .rightClick:\n                print(\"Right Action\")\n                \n            case .leftClick:\n                print(\"Left Action\")\n                \n            default:\n                break\n            }\n        }\n```\n\n## Resources\n\nYou can find the original sample code [here](SampleCode.swift).\n\n## Credits\n- Malith Nadeeshan ([malithnadeeshan](https://twitter.com/malithnadeeshan))\n\n## License\n\nMNkAlertView is released under the MIT license. See LICENSE for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnkgitbox%2Fmnkalertview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnkgitbox%2Fmnkalertview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnkgitbox%2Fmnkalertview/lists"}