{"id":16683912,"url":"https://github.com/meniny/oops","last_synced_at":"2025-04-09T23:30:21.338Z","repository":{"id":62449614,"uuid":"97489745","full_name":"Meniny/Oops","owner":"Meniny","description":"⚠️A SCLAlertView Like Dialog View for iOS in Swift","archived":false,"fork":false,"pushed_at":"2017-08-06T10:41:08.000Z","size":1366,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T18:44:54.734Z","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/Meniny.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":"2017-07-17T15:08:02.000Z","updated_at":"2022-07-17T08:56:02.000Z","dependencies_parsed_at":"2022-11-01T23:30:30.050Z","dependency_job_id":null,"html_url":"https://github.com/Meniny/Oops","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FOops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FOops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FOops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Meniny%2FOops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Meniny","download_url":"https://codeload.github.com/Meniny/Oops/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248129439,"owners_count":21052572,"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-10-12T14:27:16.656Z","updated_at":"2025-04-09T23:30:21.301Z","avatar_url":"https://github.com/Meniny.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://i.loli.net/2017/07/21/5971923186cb9.png\" alt=\"Oops\"\u003e\n  \u003cbr/\u003e\u003ca href=\"https://cocoapods.org/pods/Oops\"\u003e\n  \u003cimg alt=\"Version\" src=\"https://img.shields.io/badge/version-2.2.2-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Author\" src=\"https://img.shields.io/badge/author-Meniny-blue.svg\"\u003e\n  \u003cimg alt=\"Build Passing\" src=\"https://img.shields.io/badge/build-passing-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Swift\" src=\"https://img.shields.io/badge/swift-3.0%2B-orange.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Platforms\" src=\"https://img.shields.io/badge/platform-iOS-lightgrey.svg\"\u003e\n  \u003cimg alt=\"MIT\" src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\n  \u003cbr/\u003e\n  \u003cimg alt=\"Cocoapods\" src=\"https://img.shields.io/badge/cocoapods-compatible-brightgreen.svg\"\u003e\n  \u003cimg alt=\"Carthage\" src=\"https://img.shields.io/badge/carthage-working%20on-red.svg\"\u003e\n  \u003cimg alt=\"SPM\" src=\"https://img.shields.io/badge/swift%20package%20manager-working%20on-red.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## What's this?\n\n`Oops` is a delightful [SCLAlertView](https://github.com/dogo/SCLAlertView) like dialog view for iOS written in Swift.\n\n## Requirements\n\n* iOS 8.0+\n* Xcode 8 with Swift 3\n\n## Preview\n\n![OopsPreview](https://i.loli.net/2017/07/21/5971922e97c20.png)\n\n## Installation\n\n#### CocoaPods\n\n```ruby\npod 'Oops'\n```\n\n## Contribution\n\nYou are welcome to fork and submit pull requests.\n\n## License\n\n`Oops` is open-sourced software, licensed under the `MIT` license.\n\n## Minimum Usage\n\n```swift\nOops.show(.info, title: kInfoTitle, detail: kSubtitle)\nOops().show(.error, title: kErrorTitle, detail: kSubtitle)\n```\n\n```swift\nlet configuration = Oops.Configuration(dynamicAnimatorActive: true)\nconfiguration.shouldAutoDismiss = false\nlet alert = Oops(configuration: configuration)\nalert.addTextField(\"Username\")\nalert.addTextField(\"Password\")\nalert.addButton(\"Login\") {\n    print(\"Logged in\")\n    alert.hideView()\n}\nalert.show(.notice, title: kNoticeTitle, detail: kSubtitle)\n```\n\n## Samples\n\n```swift\nimport UIKit\nimport Oops\n\nlet kSuccessTitle = \"Congratulations\"\nlet kErrorTitle = \"Connection error\"\nlet kNoticeTitle = \"Notice\"\nlet kWarningTitle = \"Warning\"\nlet kInfoTitle = \"Info\"\nlet kSubtitle = \"You've just displayed this awesome Pop Up View\"\n\nlet kDefaultAnimationDuration = 2.0\n\nclass ViewController: UIViewController {\n\n    @IBAction func showSuccess(_ sender: AnyObject) {\n        let alert = Oops()\n        alert.addButton(\"First Button\", target: self, selector: #selector(ViewController.firstButtonAction))\n        alert.addButton(\"Second Button\") {\n            print(\"Second button tapped\")\n        }\n        alert.show(.success, title: kSuccessTitle, detail: kSubtitle)\n    }\n\n    @IBAction func showError(_ sender: AnyObject) {\n        Oops().show(.error,\n                    title: \"Hold On...\",\n                    detail: \"You have not saved your Submission yet. Please save the Submission before accessing the Responses list. Blah de blah de blah, blah. Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah.Blah de blah de blah, blah.\",\n                    completeText: \"OK\")\n    }\n\n    @IBAction func showNotice(_ sender: AnyObject) {\n        let configuration = Oops.Configuration(dynamicAnimatorActive: true)\n        Oops(configuration: configuration).show(.notice, title: kNoticeTitle, detail: kSubtitle)\n    }\n\n    @IBAction func showWarning(_ sender: AnyObject) {\n        Oops().show(.warning, title: kWarningTitle, detail: kSubtitle)\n    }\n\n    @IBAction func showInfo(_ sender: AnyObject) {\n        Oops().show(.info, title: kInfoTitle, detail: kSubtitle)\n    }\n\n    @IBAction func showEdit(_ sender: AnyObject) {\n        let configuration = Oops.Configuration(showCloseButton: false)\n        let alert = Oops(configuration: configuration)\n        let txt1 = alert.addTextField(\"Enter your given name\", text: \"Elias\")\n        let txt2 = alert.addTextField(\"Enter your family name\", text: \"Abel\")\n        alert.addTextField(\"Enter your password\", text: \"123456\", secure: true)\n//        alert.addTextView()\n//        alert.addTextView()\n        alert.addButton(\"Go\") {\n            Oops.show(.info, title: nil, detail: \"\\(txt1.text ?? \"NA\") \\(txt2.text ?? \"NA\")\")\n        }\n        alert.show(.editor, title: kInfoTitle, detail: kSubtitle)\n    }\n\n    @IBAction func showCustomSubview(_ sender: AnyObject) {\n        // Create custom configuration Configuration\n        let configuration = Oops.Configuration(\n            titleFont: UIFont(name: \"HelveticaNeue\", size: 20)!,\n            textFont: UIFont(name: \"HelveticaNeue\", size: 14)!,\n            buttonFont: UIFont(name: \"HelveticaNeue-Bold\", size: 14)!,\n            showCloseButton: false,\n            dynamicAnimatorActive: true\n        )\n        configuration.shouldAutoDismiss = false\n\n        // Initialize Oops using custom configuration\n        let alert = Oops(configuration: configuration)\n\n        // Creat the subview\n        let subview = UIView(frame: CGRect(x: 0, y: 0, width: 216, height: 100))\n        let x = (subview.frame.width - 180) / 2\n\n        // Add textfield 1\n        let textfield1 = UITextField(frame: CGRect(x: x,y: 10,width: 180,height: 40))\n        textfield1.layer.borderColor = UIColor.green.cgColor\n        textfield1.layer.borderWidth = 1.5\n        textfield1.layer.cornerRadius = 5\n        textfield1.placeholder = \"Username\"\n        textfield1.textAlignment = NSTextAlignment.center\n        subview.addSubview(textfield1)\n\n        // Add textfield 2\n        let textfield2 = UITextField(frame: CGRect(x: x, y: textfield1.frame.maxY + 10, width: 180, height: 40))\n        textfield2.isSecureTextEntry = true\n        textfield2.layer.borderColor = UIColor.blue.cgColor\n        textfield2.layer.borderWidth = 1.5\n        textfield2.layer.cornerRadius = 5\n        textfield1.layer.borderColor = UIColor.blue.cgColor\n        textfield2.placeholder = \"Password\"\n        textfield2.textAlignment = NSTextAlignment.center\n        subview.addSubview(textfield2)\n\n        // Add the subview to the alert's UI property\n        alert.customSubview = subview\n        alert.addButton(\"Login\") {\n            print(\"Logged in\")\n            alert.hideView()\n        }\n\n        // Add Button with visible timeout and custom Colors\n        let showTimeout = Oops.Button.ShowTimeoutConfiguration(prefix: \"(\", suffix: \"s)\")\n        alert.addButton(\"Timeout Button\", backgroundColor: UIColor(red:0.26, green:0.56, blue:1.00, alpha:1.00), textColor: UIColor.yellow, showTimeout: showTimeout) {\n            print(\"Timeout Button tapped\")\n        }\n\n        let timeoutValue: TimeInterval = 10.0\n        let timeoutAction: Oops.TimeoutConfiguration.ActionClosure = {\n            print(\"Timeout occurred\")\n        }\n\n        alert.show(.success, title: \"Login\", detail: \"\", timeout: Oops.TimeoutConfiguration(timeoutValue: timeoutValue, timeoutAction: timeoutAction))\n    }\n\n    @IBAction func showCustomAlert(_ sender: AnyObject) {\n        let configuration = Oops.Configuration(\n            titleFont: UIFont(name: \"HelveticaNeue\", size: 20)!,\n            textFont: UIFont(name: \"HelveticaNeue\", size: 14)!,\n            buttonFont: UIFont(name: \"HelveticaNeue-Bold\", size: 14)!,\n            showCloseButton: false,\n            dynamicAnimatorActive: true,\n            buttonsLayout: .horizontal\n        )\n        configuration.circleIconHeight = configuration.circleHeight\n//        configuration.shouldAutoDismiss = false\n\n        let alert = Oops(configuration: configuration)\n        alert.addButton(\"First Button\", target: self, selector: #selector(ViewController.firstButtonAction))\n        alert.addButton(\"Second Button\") {\n            print(\"Second button tapped\")\n        }\n//        alert.addButton(\"Third Button\") {\n//            print(\"Third button tapped\")\n//        }\n\n        let color = UIColor(red:0.87, green:0.29, blue:0.22, alpha:1.00)\n        alert.show(.notice, title: \"Custom Color\", detail: \"Custom color\", icon: #imageLiteral(resourceName: \"avatar\"), color: color)\n    }\n\n    func firstButtonAction() {\n        print(\"First button tapped\")\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Foops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeniny%2Foops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeniny%2Foops/lists"}