import SortSwiftImports
let sortSwiftImports: SortSwiftImports = .live
let code: String = // swift source code
let result = sortSwiftImports(in: code)
switch result {
case let .success(output):
print(output)
case let .failure(error):
print(error)
}
🅰️ macOS application
Native 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.
It also contains Xcode Source Editor extensionso that you can sort your Swift imports directly from Xcode. Ensure you have enabled Sort Imports extension in System Preferences → Extensions → Xcode Source Editor.
macOS
🅰️ iOS application
Native SwiftUI iOS application that you can use to sort imports in your Swift source code. Just paste your code and tap ⚙️ → Sort swift imports.
On your iPad, you can use multiple windows of the app simultaneously.
iPhone
iPad
🛠 Development
Open SortSwiftImports.xcworkspace in Xcode (⩾13.2) for development.
Sort (Swift) Imports
Sort
import
statements in your Swift source code.🏛 Swift Library
Add
sort-swift-imports
package dependency to your Swift Package:Add
SortSwiftImports
library as a dependency to your targets:Use
SortSwiftImports
from your code:🅰️ macOS application
Native 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.It also contains Xcode Source Editor extensionso that you can sort your Swift imports directly from Xcode. Ensure you have enabled
Sort Imports
extension inSystem Preferences
→Extensions
→Xcode Source Editor
.🅰️ iOS application
Native SwiftUI iOS application that you can use to sort imports in your Swift source code. Just paste your code and tap
⚙️
→Sort swift imports
.On your iPad, you can use multiple windows of the app simultaneously.
🛠 Development
Open
SortSwiftImports.xcworkspace
in Xcode (⩾13.2) for development.🧰 Workspace structure
▶️ Build schemes
SortSwiftImportsMacApp
scheme to build and run the macOS application.SortSwiftImportsMacApp
scheme to run all tests on macOS.SortSwiftImportsIOSApp
scheme to build and run the iOS application.SortSwiftImportsIOSApp
scheme to run all tests on iOS simulator.SortSwiftImportsXcodeExtension
scheme to build and run the Xcode Source Editor Extension.AppIcon
scheme for building & previewing the app icon in Xcode (use macOS destination).ExportAppIcon
scheme for exporting the app icon into asset catalog (use macOS destination).Use other schemes for building and testing the libraries.
🙋♂️ Contributing
☕️ Do you like the project?
Consider supporting further development and buy me a coffee.
📄 License
Copyright © 2021 Dariusz Rybicki Darrarski
License: MIT