{"id":22358781,"url":"https://github.com/darrarski/sort-swift-imports","last_synced_at":"2025-07-30T12:32:04.495Z","repository":{"id":63907685,"uuid":"441025525","full_name":"darrarski/sort-swift-imports","owner":"darrarski","description":"Sort import statements in your Swift source code.","archived":false,"fork":false,"pushed_at":"2024-05-14T16:46:55.000Z","size":14188,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-30T17:49:17.987Z","etag":null,"topics":["sorting","swift","xcode"],"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/darrarski.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":"2021-12-23T01:10:25.000Z","updated_at":"2024-05-17T10:15:36.000Z","dependencies_parsed_at":"2022-11-29T13:21:14.989Z","dependency_job_id":null,"html_url":"https://github.com/darrarski/sort-swift-imports","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fsort-swift-imports","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fsort-swift-imports/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fsort-swift-imports/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fsort-swift-imports/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darrarski","download_url":"https://codeload.github.com/darrarski/sort-swift-imports/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228133618,"owners_count":17874511,"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":["sorting","swift","xcode"],"created_at":"2024-12-04T15:17:42.059Z","updated_at":"2024-12-04T15:17:42.522Z","avatar_url":"https://github.com/darrarski.png","language":"Swift","funding_links":["https://www.buymeacoffee.com/darrarski"],"categories":[],"sub_categories":[],"readme":"# Sort (Swift) Imports\n\n![Swift 5.10](https://img.shields.io/badge/swift-5.10-orange.svg)\n![platform macOS iOS](https://img.shields.io/badge/platform-macOS_|_iOS-blue.svg)\n\nSort `import` statements in your Swift source code.\n\n## 🏛 Swift Library\n\nAdd `sort-swift-imports` package dependency to your Swift Package:\n\n```swift\n.package(\n  url: \"https://github.com/darrarski/sort-swift-imports.git\",\n  from: \"1.0.0\"\n),\n```\n\nAdd `SortSwiftImports` library as a dependency to your targets: \n\n```swift\n.product(\n  name: \"SortSwiftImports\", \n  package: \"sort-swift-imports\"\n),\n```\n\nUse `SortSwiftImports` from your code:\n\n```swift\nimport SortSwiftImports\n\nlet sortSwiftImports: SortSwiftImports = .live\nlet code: String = // swift source code\nlet result = sortSwiftImports(in: code)\nswitch result {\ncase let .success(output):\n  print(output)\ncase let .failure(error):\n  print(error)\n}\n```\n\n## 🅰️ macOS application\n\n\u003ca href=\"https://apps.apple.com/app/sort-imports/id1601715398\"\u003e\n  \u003cimg src=\"Misc/Download_on_the_App_Store_badge.png\" alt=\"Download on the App Store\" align=\"right\" width=\"200\"/\u003e\n\u003c/a\u003e\n\nNative **SwiftUI** macOS application that you can use to sort imports in your Swift source code. Just paste your code and click the `Sort swift imports` button.\n\nIt also contains **Xcode Source Editor extension**so that you can sort your Swift imports directly from Xcode. Ensure you have enabled `Sort Imports` extension in `System Preferences` → `Extensions` → `Xcode Source Editor`.\n\n|macOS|\n|:-:|\n|![macOS app screenshot light mode](Misc/Screenshots/macOS/macOS-light-1.png#gh-light-mode-only)![macOS app screenshot dark mode](Misc/Screenshots/macOS/macOS-dark-1.png#gh-dark-mode-only)|\n\n## 🅰️ iOS application\n\n\u003ca href=\"https://apps.apple.com/app/sort-imports/id1601715398\"\u003e\n  \u003cimg src=\"Misc/Download_on_the_App_Store_badge.png\" alt=\"Download on the App Store\" align=\"right\" width=\"200\"/\u003e\n\u003c/a\u003e\n\nNative **SwiftUI** iOS application that you can use to sort imports in your Swift source code. Just paste your code and tap `⚙️` → `Sort swift imports`.\n\nOn your iPad, you can use multiple windows of the app simultaneously.\n\n|iPhone|iPad|\n|:-:|:-:|\n|![iPhone app screenshot light mode](Misc/Screenshots/iPhone-5.5in/iPhone-5.5in-light-1.png#gh-light-mode-only)![iPhone app screenshot dark mode](Misc/Screenshots/iPhone-5.5in/iPhone-5.5in-dark-1.png#gh-dark-mode-only)|![iPad app screenshot light mode](Misc/Screenshots/iPad-Pro-12.9in-2nd-gen/iPad-Pro-12.9in-2nd-gen-light-1.png#gh-light-mode-only)![iPad app screenshot dark mode](Misc/Screenshots/iPad-Pro-12.9in-2nd-gen/iPad-Pro-12.9in-2nd-gen-dark-1.png#gh-dark-mode-only)|\n\n## 🛠 Development\n\nOpen `SortSwiftImports.xcworkspace` in Xcode (⩾15.4) for development.\n\n### 🧰 Workspace structure\n\n```\nSortSwiftImports (Xcode Workspace)\n ├─ sort-swift-imports (Swift Package)\n │   └─ SortSwiftImports (Library)\n ├─ sort-swift-imports-app (Swift Package)\n │   ├─ AppFeature (Library)\n │   └─ EditorFeature (Library)\n ├─ sort-swift-imports-app-icon (Swift Package)\n │   ├─ AppIcon (Library)\n │   └─ AppIconExport (macOS executable)\n └─ Project (Xcode Project)\n     ├─ SortSwiftImportsApp (iOS and macOS Application)\n     └─ SortSwiftImportsXcodeExtension (Xcode Source Editor Extension)\n```\n\n### ▶️ Build schemes\n\n- Use `SortSwiftImportsApp` scheme to build, run, and test the application on iOS and macOS.\n- Use `SortSwiftImportsXcodeExtension` scheme to build and run the Xcode Source Editor Extension. \n- Use `AppIcon` scheme for building \u0026 previewing the app icon in Xcode (use macOS destination).\n- Use `ExportAppIcon` scheme for exporting the app icon into asset catalog (use macOS destination).\n\nUse other schemes for building and testing individual feature-libraries in isolation.\n\n### 🙋‍♂️ Contributing\n\n- All contributions are welcome!\n- Create a pull request containing your changes or bug fixes.\n- Make sure to add tests for the new/updated code.\n\n## ☕️ Do you like the project?\n\n\u003ca href=\"https://www.buymeacoffee.com/darrarski\" target=\"_blank\"\u003e\n  \u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" align=\"right\" height=\"60\"/\u003e\n\u003c/a\u003e\n\nConsider supporting further development and buy me a coffee.\n\n\u0026nbsp;\n\n## 📄 License\n\nCopyright © 2021 Dariusz Rybicki Darrarski\n\nLicense: [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fsort-swift-imports","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarrarski%2Fsort-swift-imports","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fsort-swift-imports/lists"}