{"id":18574164,"url":"https://github.com/devpolant/nativeui","last_synced_at":"2025-09-03T17:41:10.403Z","repository":{"id":51979666,"uuid":"253223544","full_name":"devpolant/NativeUI","owner":"devpolant","description":"iOS library that includes customizable replacements for native UIKit components","archived":false,"fork":false,"pushed_at":"2023-04-10T10:05:35.000Z","size":2106,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T18:21:59.538Z","etag":null,"topics":["alert","customization","ios","ios-alert","native-alert","nativeui","swift","uialertcontroller","uikit"],"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/devpolant.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":"2020-04-05T11:55:42.000Z","updated_at":"2023-04-10T09:56:56.000Z","dependencies_parsed_at":"2022-08-25T03:13:02.882Z","dependency_job_id":null,"html_url":"https://github.com/devpolant/NativeUI","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devpolant%2FNativeUI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devpolant%2FNativeUI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devpolant%2FNativeUI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devpolant%2FNativeUI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devpolant","download_url":"https://codeload.github.com/devpolant/NativeUI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248176571,"owners_count":21060090,"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","customization","ios","ios-alert","native-alert","nativeui","swift","uialertcontroller","uikit"],"created_at":"2024-11-06T23:14:13.649Z","updated_at":"2025-04-10T07:32:51.640Z","avatar_url":"https://github.com/devpolant.png","language":"Swift","readme":"[![Swift](https://img.shields.io/badge/Swift-5.7-orange.svg)](https://swift.org)\n[![Xcode](https://img.shields.io/badge/Xcode-14.0-blue.svg)](https://developer.apple.com/xcode)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/NativeUI.svg)](https://cocoapods.org/pods/NativeUI)\n[![MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)\n\n# NativeUI\n\n## Minimum Requirements:\n- iOS 11.0\n- Xcode 14.0\n- Swift 5\n\n## Installation\n\n### Swift Package Manager\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/devpolant/NativeUI.git\", .upToNextMajor(from: \"1.2.2\"))\n]\n```\n\n#### CocoaPods\n\n```ruby\ntarget 'MyApp' do\n  pod 'NativeUI', '~\u003e 1.2.2'\nend\n```\n\nIf you don't need to connect all UI components you may use subspecs like:\n\n```ruby\ntarget 'MyApp' do\n  pod 'NativeUI/Alert', '~\u003e 1.2.2'\nend\n```\n\nAvailable subspecs:\n- `Utils`\n- `Alert`\n\n## Alert\n\n\u003cimg src=\"https://github.com/devpolant/NativeUI/blob/master/Example/Demo/default.gif\" width=\"250\" /\u003e \u003cimg src=\"https://github.com/devpolant/NativeUI/blob/master/Example/Demo/custom.gif\" width=\"250\" /\u003e\n\n**`AlertViewController` is a customizable replacement for native `UIAlertController`.**\n\nSometimes we need to set NSAttributedString into native alert, but public API doesn't allow it. As a workaroud we could use private API, but in general we should avoid using it.\n\n`AlertViewController` looks exactly like native `UIAlertController`, but very configurable.\n\n### Configuration\n\n1. Default initialization with title, message as `String`.\n\n```swift\nlet cancelAction = Alert.Action(title: \"Cancel\", style: .primary)\nlet confirmAction = Alert.Action(title: \"Confirm\", style: .default)\n            \nlet viewModel = Alert(\n    title: \"Your Title\",\n    titleFont: ... // your custom title font\n    message: \"Your Message\",\n    messageFont: ... // your custom message font\n    actions: [cancelAction, confirmAction]\n)\nlet alert = AlertViewController(viewModel: viewModel)\npresent(alert, animated: true)\n```\n\n2. Default initialization with title, message as `NSAttributedString`\n\n```swift\nlet cancelAction = Alert.Action(title: \"Cancel\", style: .primary)\nlet confirmAction = Alert.Action(title: \"Confirm\", style: .default)\n            \nlet viewModel = Alert(\n    title: ... // your title (NSAttributedString)\n    message: ... // your message (NSAttributedString)\n    actions: [cancelAction, confirmAction]\n)\nlet alert = AlertViewController(viewModel: viewModel)\npresent(alert, animated: true)\n```\n\n3. Initialization with title, message and custom `UIView` object as content view to implement complex layout.\n\n\n```swift\nlet cancelAction = Alert.Action(title: \"Cancel\", style: .primary)\nlet confirmAction = Alert.Action(title: \"Confirm\", style: .default)\n\nlet customView = CustomView()\ncustomView.translatesAutoresizingMaskIntoConstraints = false\ncustomView.imageView.backgroundColor = .orange\ncustomView.titleLabel.text = \"Some text\"\ncustomView.subtitleLabel.text = \"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\"\n\nlet viewModel = Alert(\n    title: \"Your Title\",\n    message: nil,\n    contentView: customView,\n    actions: [cancelAction, confirmAction]\n)\nlet alert = AlertViewController(viewModel: viewModel)\npresent(alert, animated: true)\n```\n\nSee [Alert.swift](https://github.com/devpolant/NativeUI/blob/master/NativeUI/Sources/Alert/Alert.swift) for more details.\n\n### Edge cases\n\nWhen you need to present few alerts in a row you should set `shouldDismissAutomatically` flag to `false` and add action AFTER view controller initialization to be able to capture alert instance in action handler's closure.\n\n```swift\n\nlet viewModel = Alert(\n    title: \"Your Title\",\n    message: \"Your Message\"\n)\nlet alert = AlertViewController(viewModel: viewModel)\nalert.shouldDismissAutomatically = false\n\nlet cancelAction = Alert.Action(title: \"Cancel\", style: .primary) { [weak alert] _ in\n    alert?.dismiss(animated: true) {\n        // present something else\n    }\n}\nalert.addAction(cancelAction)\n\nlet confirmAction = Alert.Action(title: \"Confirm\", style: .default) { [weak alert] _ in\n    alert?.dismiss(animated: true) {\n        // present something else\n    }\n}\nalert.addAction(confirmAction)\n\npresent(alert, animated: true)\n```\n\n## Author\n\nAnton Poltoratskyi\n\n## License\n\nNativeUI is available under the MIT license. See the [LICENSE](https://github.com/devpolant/NativeUI/blob/master/LICENSE) file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevpolant%2Fnativeui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevpolant%2Fnativeui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevpolant%2Fnativeui/lists"}