Swift

Swift

Made by DeepSource

Duplicate import statements are redundant and can be removed SW-W1000

Anti-pattern
Minor
Autofix

Duplicate import statements are redundant and can be removed from Swift source code. Importing an entity twice does not add any value and can clutter the code. It can lead to increased build times and difficulties in debugging and maintaining the codebase.

Removing duplicate import statements can improve code readability and reduce the risk of conflicts or naming collisions. This issue can be fixed by removing the duplicate import statements.

Bad Practice

import Foundation
import UIKit
import Foundation // Duplicate import

class MyViewController: UIViewController {
    // ...
}

Recommended

import Foundation
import UIKit

class MyViewController: UIViewController {
    // ...
}