{"id":18333478,"url":"https://github.com/sochalewski/textfieldalert","last_synced_at":"2025-04-06T03:34:23.396Z","repository":{"id":39816163,"uuid":"507166178","full_name":"sochalewski/TextFieldAlert","owner":"sochalewski","description":"A SwiftUI alert with text field(s) for iOS/tvOS 13 and greater.","archived":false,"fork":false,"pushed_at":"2023-08-01T14:02:55.000Z","size":1292,"stargazers_count":26,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T13:16:41.147Z","etag":null,"topics":["ios","swift","swiftui","tvos"],"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/sochalewski.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-24T23:14:21.000Z","updated_at":"2025-01-23T09:44:15.000Z","dependencies_parsed_at":"2024-11-05T19:58:44.911Z","dependency_job_id":"1cad2a3f-3dac-45f1-afeb-715b7bbe60b5","html_url":"https://github.com/sochalewski/TextFieldAlert","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"f14abe4cc8625013d680d3f3b13944b0c9c47ba5"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sochalewski%2FTextFieldAlert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sochalewski%2FTextFieldAlert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sochalewski%2FTextFieldAlert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sochalewski%2FTextFieldAlert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sochalewski","download_url":"https://codeload.github.com/sochalewski/TextFieldAlert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430838,"owners_count":20937873,"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":["ios","swift","swiftui","tvos"],"created_at":"2024-11-05T19:42:31.577Z","updated_at":"2025-04-06T03:34:18.383Z","avatar_url":"https://github.com/sochalewski.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TextFieldAlert\n\nA SwiftUI alert with text field(s) for iOS 13+ and tvOS 13+.\n\nAs Apple is [going to introduce](https://sarunw.com/posts/swiftui-alert-textfield/) text field(s) as an alert actions in iOS 16, this is a good replacement for older versions.\n\n## Requirements\n* iOS 13.0+ or tvOS 13.0+\n* Swift 5.1+\n\n## Installation\n\nYou can add TextFieldAlert to an Xcode project by adding it as a package dependency.\n\n  1. From the **File** menu, select **Add Packages…**\n  2. Enter `https://github.com/sochalewski/TextFieldAlert` into the package repository URL text field.\n  3. Add the package to your app target.\n\n## Usage\n\nTextFieldAlert is exposed through `View` extension:\n\n```swift\nfunc textFieldAlert(\n    title: String?,\n    message: String?,\n    textFields: [TextFieldAlert.TextField],\n    actions: [TextFieldAlert.Action],\n    isPresented: Binding\u003cBool\u003e\n)\n```\n\nYou can use it in your code as follows:\n\n```swift\nstruct ExampleView: View {\n    \n    @State var isPresented = false\n    @State var text1 = \"\"\n    @State var text2 = \"\"\n    \n    var body: some View {\n        VStack {\n            Button {\n                isPresented = true\n            } label: {\n                Text(\"Alert\")\n            }\n            \n            Text(text1)\n            Text(text2)\n        }\n        .textFieldAlert(\n            title: \"Title\",\n            message: \"Message\",\n            textFields: [\n                .init(text: $text1),\n                .init(text: $text2)\n            ],\n            actions: [\n                .init(title: \"OK\")\n            ],\n            isPresented: $isPresented\n        )\n    }\n}\n```\n\nMore advanced usage (incl.  moving the responsibility to a view model, some customization and enabling action buttons conditionally) is available in the Example app.\n\n\u003cimg src=\"Resources/TextFieldAlert.gif\" width=\"300\"\u003e\n\n## Author\n\nPiotr Sochalewski, \u003ca href=\"http://sochalewski.github.io\"\u003esochalewski.github.io\u003c/a\u003e\n\nTextFieldAlert is heavily inspired by [tanzolone](https://stackoverflow.com/users/3033314/tanzolone)'s [answer](https://stackoverflow.com/a/61902990) on StackOverflow.\n\n## License\n\nTextFieldAlert is available under the MIT license. See the LICENSE file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsochalewski%2Ftextfieldalert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsochalewski%2Ftextfieldalert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsochalewski%2Ftextfieldalert/lists"}